emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] link fontification issue in org 9.0.8


From: John Kitchin
Subject: [O] link fontification issue in org 9.0.8
Date: Wed, 21 Jun 2017 07:20:11 -0400

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 "<font color=\"red\">%s</font>"
                     (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]