emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: link fontification issue in org 9.0.8
Date: Wed, 21 Jun 2017 07:20:11 -0400	[thread overview]
Message-ID: <CAJ51ETqUeK0=ziAp3X37uo=pUYHnpXyoXdMGdgwnTBA2rtp8sQ@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2017-06-21 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21 11:20 John Kitchin [this message]
2017-06-21 20:58 ` link fontification issue in org 9.0.8 Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ51ETqUeK0=ziAp3X37uo=pUYHnpXyoXdMGdgwnTBA2rtp8sQ@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).