emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* link fontification issue in org 9.0.8
@ 2017-06-21 11:20 John Kitchin
  2017-06-21 20:58 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: John Kitchin @ 2017-06-21 11:20 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2334 bytes --]

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
@johnkitchin
http://kitchingroup.cheme.cmu.edu

[-- Attachment #2: Type: text/html, Size: 5192 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-21 20:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-21 11:20 link fontification issue in org 9.0.8 John Kitchin
2017-06-21 20:58 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).