From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WAA3AkHew16ZUwAA0tVLHw (envelope-from ) for ; Tue, 19 May 2020 13:25:21 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id sNysOUDew14UEgAAB5/wlQ (envelope-from ) for ; Tue, 19 May 2020 13:25:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2BC4C940145 for ; Tue, 19 May 2020 13:25:20 +0000 (UTC) Received: from localhost ([::1]:47826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jb2FD-0002OJ-5o for larch@yhetil.org; Tue, 19 May 2020 09:25:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jb2E0-0001XX-W7 for emacs-orgmode@gnu.org; Tue, 19 May 2020 09:24:05 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:37864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jb2Dz-0007aw-Gx for emacs-orgmode@gnu.org; Tue, 19 May 2020 09:24:04 -0400 Received: by mail-wm1-x32c.google.com with SMTP id z72so3566254wmc.2 for ; Tue, 19 May 2020 06:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ANFyRnSLKFfw3W7KMH/egswf6lBkqCwAtNY10x4r6mQ=; b=hgR+WRmUBilgt4xpp5wmcPDZmcRg5HrS5AiovYX8Xfv1ghnkSGb25/H/1EAnbdEStz Rl0kAdD/HSn4A9wCF9U5AZ4mlaOBfzGid7FlbFuCPtutQ/ZRuTQOGNgoOy5TfoQHVYC7 1fhcDzzJ+KVmGcnbww53qhNqFCPhermWbN0JFMPeqmG9Co115Aw5oYxATuBIcYvhkTVj 9PjZmThrbTg+EZolTWwAHwTUq05V2Tklq7ueY6RA3eQNDowGpp0gpAY9iIv1LBTtzm/0 jgtVDs75uc9Q9FCnbjoDVkXVoez/ddnYlPOIH1/n5sHztTJrCpfh24Js4nm4e9JznOY0 OvaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ANFyRnSLKFfw3W7KMH/egswf6lBkqCwAtNY10x4r6mQ=; b=VCbQ4TsMJ4FtQRbQrLxiM9e/aOuCqvsAefcbbyfeeOECNHRmx141nYRwwwILtJNvcs PEk13Cmh7NDPMVQHKosu0L6E5N1hubzIL1doaGSV8/fzTHDQuQEGMCgj7IINaAPh1Gdg nOZN9loI7TOwnBe67yqUF00DtrL9rdeWzReCl71nYLrm21VISlW8mv70xvORdF3MTm5R +tS6++WBDcOJq/74HG9KxqRp+kYX7j+X+GSuldehuFyAGlcOW4u+Zr9wUAXGNGZlqb2O Y4IjNsM4ZYpZep9Z0DKk6ygASvWbAw4vPbjv4CpuHlLQbTR6kwe+ZogyYdYAAUMvyfxG LupA== X-Gm-Message-State: AOAM531wNGgLInr8mfQ6LIrcnApfzFall6KxGpsx8pGygqlcXzrJxbjD /RX3IDvcWuXP9C/0tfAhQuATspUXcux99Dikov4= X-Google-Smtp-Source: ABdhPJz6u88dYtMIRZINIF7f0niZQ4mPmsymxqePSbC/7V2hx9V6tmsJilWcGf1VI704kYEgBrolm0BZGeCe/+jzRRY= X-Received: by 2002:a1c:2348:: with SMTP id j69mr5622089wmj.11.1589894641748; Tue, 19 May 2020 06:24:01 -0700 (PDT) MIME-Version: 1.0 References: <87wo58jch2.fsf@gmail.com> In-Reply-To: <87wo58jch2.fsf@gmail.com> From: John Kitchin Date: Tue, 19 May 2020 09:23:50 -0400 Message-ID: Subject: Re: [Question] why my org-link-set-parameters :face function does not work? To: stardiviner Content-Type: multipart/alternative; boundary="0000000000005a0c7e05a60031e8" Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=johnrkitchin@gmail.com; helo=mail-wm1-x32c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org Mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=hgR+WRmU; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: 1.39 X-TUID: EPPoVTDFesPv --0000000000005a0c7e05a60031e8 Content-Type: text/plain; charset="UTF-8" The face function only takes the link path, which is a string. you cannot use org-element-property on it. Maybe you want something like this: #+begin_src emacs-lisp (defun org-link-beautify-face (path) "Set link face colors." (message "beautifying") (if (and (not (file-remote-p path)) (file-exists-p (expand-file-name path))) 'org-link 'org-warning)) ;;; DEBUG (org-link-set-parameters "file" :face #'org-link-beautify-face) #+end_src John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, May 19, 2020 at 9:12 AM stardiviner wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > > Bellowing is my source code, it does not work. I'm wondering why? > > #+begin_src emacs-lisp > (defun org-link-beautify-face (link) > "Set link face colors." > (let ((raw-link (org-element-property :raw-link link)) > (type (org-element-property :type link)) > (path (org-element-property :path link))) > (pcase type > ;; ("https" ) > ;; ("http" ) > ("file" > (if (and (not (file-remote-p path)) > (file-exists-p (expand-file-name path))) > 'org-link 'org-warning))))) > > ;;; DEBUG > (org-link-set-parameters > "file" > :face #'org-link-beautify-face) > #+end_src > > - -- > [ stardiviner ] > I try to make every word tell the meaning that I want to express. > > Blog: https://stardiviner.github.io/ > IRC(freenode): stardiviner, Matrix: stardiviner > GPG: F09F650D7D674819892591401B5DF1C95AE89AC3 > > -----BEGIN PGP SIGNATURE----- > > iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7D2xkUHG51bWJjaGls > ZEBnbWFpbC5jb20ACgkQG13xyVromsMfHAgAjnoQlzdHlcKL/rBVBLlkmMITh7f5 > 6SxRw9sS1BagIma+APiuy+A4O4fSDLyzUMDg+Sg/C+vNu3QC2BM7ipBYNXtWcX1M > oPZj8loMrnISTIK51j2+9Pg0iOP1aZSvZqwA0p1mK2aZURBXWl7qDkVxD2oWji5P > qCBVr9ZFUloGSl7PtZTlOtsCgTCGHvnfvnk7vqxY4beuavQgaRSWUCsVDDO0c/M6 > 5CSzxobElB3Y68fQ2awuQwRGCzfEvRkGShHp3Raug+EJ5Ew+MYEi6wILfPxYF2WR > VJjuxAxseBuiIjYjF91xzbR7mSZQsvB1gNttLYb3uQ/jrgj0HOQDo5Jmtg== > =4fE9 > -----END PGP SIGNATURE----- > > --0000000000005a0c7e05a60031e8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The face function only takes the link path, which is a str= ing. you cannot use org-element-property on it.

Maybe yo= u want something like this:

#+begin_src emacs-lisp=
(defun org-link-beautify-face (path)
=C2=A0 "Set link face colo= rs."
=C2=A0 (message "beautifying")
=C2=A0 (if (and (n= ot (file-remote-p path))
=C2=A0 (file-exists-p (expand-file-name path)= ))
=C2=A0 =C2=A0 =C2=A0 'org-link
=C2=A0 =C2=A0 'org-warning)= )

;;; DEBUG
(org-link-set-parameters
=C2=A0"file"=C2=A0:face #'org-link-beautify-face)
#+end_src

John

-----= ------------------------------
Professor John Kitchin=C2=A0
Doherty H= all A207F
Department of Chemical Engineering
Carnegie Mellon Universi= ty
Pittsburgh, PA 15213
412-268-7803

<= /div>

On Tue, May 19, 2020 at 9:12 AM stardiviner <numbchild@gmail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Bellowing is my source code, it does not work. I'm wondering why?

#+begin_src emacs-lisp
(defun org-link-beautify-face (link)
=C2=A0 "Set link face colors."
=C2=A0 (let ((raw-link (org-element-property :raw-link link))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (type (org-element-property :type link))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (path (org-element-property :path link)))
=C2=A0 =C2=A0 (pcase type
=C2=A0 =C2=A0 =C2=A0 ;; ("https" )
=C2=A0 =C2=A0 =C2=A0 ;; ("http" )
=C2=A0 =C2=A0 =C2=A0 ("file"
=C2=A0 =C2=A0 =C2=A0 =C2=A0(if (and (not (file-remote-p path))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (file-exists-p (exp= and-file-name path)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'org-link 'org-warning))))= )

;;; DEBUG
(org-link-set-parameters
=C2=A0"file"
=C2=A0:face #'org-link-beautify-face)
#+end_src

- --
[ stardiviner ]
=C2=A0 =C2=A0 =C2=A0 =C2=A0I try to make every word tell the meaning that I= want to express.

=C2=A0 =C2=A0 =C2=A0 =C2=A0Blog: https://stardiviner.github.io/ =C2=A0 =C2=A0 =C2=A0 =C2=A0IRC(freenode): stardiviner, Matrix: stardiviner<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
-----BEGIN PGP SIGNATURE-----

iQFIBAEBCAAyFiEE8J9lDX1nSBmJJZFAG13xyVromsMFAl7D2xkUHG51bWJjaGls
ZEBnbWFpbC5jb20ACgkQG13xyVromsMfHAgAjnoQlzdHlcKL/rBVBLlkmMITh7f5
6SxRw9sS1BagIma+APiuy+A4O4fSDLyzUMDg+Sg/C+vNu3QC2BM7ipBYNXtWcX1M
oPZj8loMrnISTIK51j2+9Pg0iOP1aZSvZqwA0p1mK2aZURBXWl7qDkVxD2oWji5P
qCBVr9ZFUloGSl7PtZTlOtsCgTCGHvnfvnk7vqxY4beuavQgaRSWUCsVDDO0c/M6
5CSzxobElB3Y68fQ2awuQwRGCzfEvRkGShHp3Raug+EJ5Ew+MYEi6wILfPxYF2WR
VJjuxAxseBuiIjYjF91xzbR7mSZQsvB1gNttLYb3uQ/jrgj0HOQDo5Jmtg=3D=3D
=3D4fE9
-----END PGP SIGNATURE-----

--0000000000005a0c7e05a60031e8--