From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: link fontification issue in org 9.0.8 Date: Wed, 21 Jun 2017 07:20:11 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1144272e2b67d00552768da3" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dNdgF-0007OY-7q for emacs-orgmode@gnu.org; Wed, 21 Jun 2017 07:20:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dNdgD-00058K-9q for emacs-orgmode@gnu.org; Wed, 21 Jun 2017 07:20:15 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:36799) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dNdgC-00057f-V8 for emacs-orgmode@gnu.org; Wed, 21 Jun 2017 07:20:13 -0400 Received: by mail-wr0-x229.google.com with SMTP id c11so75053094wrc.3 for ; Wed, 21 Jun 2017 04:20:12 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "emacs-orgmode@gnu.org" --001a1144272e2b67d00552768da3 Content-Type: text/plain; charset="UTF-8" in a recent upgrade to 9.0.8, all the links have reverted to being fontified with an org-link face. For example, this link definition #+BEGIN_SRC emacs-lisp (org-link-set-parameters "red" :follow (lambda (path) (message "You clicked me.")) :export (lambda (path desc backend) (cond ((eq 'html backend) (format "%s" (or desc path))))) :face '(:foreground "red") :help-echo "Click me for a message.") #+END_SRC #+RESULTS: should make this link -> red:test have a red face with a tooltip, but it is just a blue org-link face with the standard tooltip. The follow and export function seems to work, but not the face and help-echo. I think this is related to the consolidation of org-activate-links. In the properties section it incorrectly uses code like: (org-link-get-parameter type :face) where type is defined as plain/bracket/... etc. That code should be replaced with this, which gets the link-type from (link-type (org-element-property :type link-object)) and replaces type with link-type. This is around line 5982 in org.el (let* ((link-object (save-excursion (goto-char start) (save-match-data (org-element-link-parser)))) (link (org-element-property :raw-link link-object)) (link-type (org-element-property :type link-object)) (path (org-element-property :path link-object)) (properties ;for link's visible part (list 'face (pcase (org-link-get-parameter link-type :face) ((and (pred functionp) face) (funcall face path)) ((and (pred facep) face) face) ((and (pred consp) face) face) ;anonymous (_ 'org-link)) 'mouse-face (or (org-link-get-parameter link-type :mouse-face) 'highlight) 'keymap (or (org-link-get-parameter link-type :keymap) org-mouse-map) 'help-echo (pcase (org-link-get-parameter link-type :help-echo) ((and (pred stringp) echo) echo) ((and (pred functionp) echo) echo) (_ (concat "LINK: " link))) 'htmlize-link (pcase (org-link-get-parameter link-type :htmlize-link) ((and (pred functionp) f) (funcall f)) (_ `(:uri ,link))) 'font-lock-multiline t))) 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 --001a1144272e2b67d00552768da3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
in a recent upgrade to 9.0.8, all the links have reverted = to being fontified with an org-link face.

For example, t= his link definition

#+BEGIN_SRC emacs-lisp
(org-link-set-parameters
=C2=A0"red"
= =C2=A0:follow (lambda (path) (message "You clicked me."))
=C2=A0:export (lambda (path desc backend)
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0(cond
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 ((eq 'html backend)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(format "<font color=3D\"red\">%s</fon= t>"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(or desc path)))))
=C2=A0:face '(:for= eground "red")
=C2=A0:help-echo "Click me for a me= ssage.")
#+END_SRC

#+RESULTS:
=

should make this link -> red:test=C2=A0
have a red face with a tooltip, but it is just a blue org-link= face with the standard tooltip. The follow and export function seems to wo= rk, but not the face and help-echo.

I think this i= s related to the consolidation of org-activate-links. In the properties sec= tion it incorrectly uses code like:=C2=A0(org-link-get-parameter type :face= ) where type is defined as plain/bracket/... etc. That code should be repla= ced with this, which gets the link-type from (link-type (org-element-proper= ty :type link-object)) and replaces type with link-type.

This is around line 5982 in org.el

(le= t* ((link-object (save-excursion
(goto-char start)
(save-= match-data (org-element-link-parser))))
(link (org-element-property= :raw-link link-object))
(link-type (org-element-property :type lin= k-object))
(path (org-element-property :path link-object))
= (properties = ;for link's visible part
=C2=A0(list
=C2=A0 = 9;face (pcase (org-link-get-parameter link-type :face)
=C2=A0 ((an= d (pred functionp) face) (funcall face path))
=C2=A0 ((and (pred f= acep) face) face)
=C2=A0 ((and (pred consp) face) face) ;anonymous=
= =C2=A0 (_ 'org-link))
=C2=A0 'mouse-face (or (org= -link-get-parameter link-type :mouse-face)
=C2=A0 'highlight)=
= =C2=A0 'keymap (or (org-link-get-parameter link-type :keymap)<= /div>
= =C2=A0 =C2=A0 =C2=A0 org-mouse-map)
=C2=A0 'help-echo = (pcase (org-link-get-parameter link-type :help-echo)
((and (pred = stringp) echo) echo)
((and (pred functionp) echo) echo)
(_ (concat "LINK: " link)))
=C2=A0 'htmlize-link (pc= ase (org-link-get-parameter link-type
:htmlize-link)
= =C2=A0 ((and (pred functionp) f) (funcall f))
=C2=A0 (_ `(:uri ,= link)))
=C2=A0 'font-lock-multiline t)))


John

-----------------------------------<= br>Professor John Kitchin=C2=A0
Doherty Hall A207F
Department of Chem= ical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
4= 12-268-7803
--001a1144272e2b67d00552768da3--