emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: link fontification issue in org 9.0.8
Date: Wed, 21 Jun 2017 22:58:13 +0200	[thread overview]
Message-ID: <87vanp83dm.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CAJ51ETqUeK0=ziAp3X37uo=pUYHnpXyoXdMGdgwnTBA2rtp8sQ@mail.gmail.com> (John Kitchin's message of "Wed, 21 Jun 2017 07:20:11 -0400")

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> 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)))

Fixed. Thank you for the report and the analysis.

Regards,

-- 
Nicolas Goaziou

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

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

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=87vanp83dm.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    /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).