From 521734d51fa2695257793886cb62d16851185d63 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 21 Jun 2017 22:55:10 +0200 Subject: [PATCH] Fix link fontification * lisp/org.el (org-activate-links): Fix link fontification. Reported-by: John Kitchin --- lisp/org.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index b89044cd4..22b7dbfda 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5964,12 +5964,12 @@ This includes angle, plain, and bracket links." (while (re-search-forward org-any-link-re limit t) (let* ((start (match-beginning 0)) (end (match-end 0)) - (type (cond ((eq ?< (char-after start)) 'angle) - ((eq ?\[ (char-after (1+ start))) 'bracket) - (t 'plain)))) - (when (and (memq type org-highlight-links) + (style (cond ((eq ?< (char-after start)) 'angle) + ((eq ?\[ (char-after (1+ start))) 'bracket) + (t 'plain)))) + (when (and (memq style org-highlight-links) ;; Do not confuse plain links with tags. - (not (and (eq type 'plain) + (not (and (eq style 'plain) (let ((face (get-text-property (max (1- start) (point-min)) 'face))) (if (consp face) (memq 'org-tag face) @@ -5978,6 +5978,7 @@ This includes angle, plain, and bracket links." (goto-char start) (save-match-data (org-element-link-parser)))) (link (org-element-property :raw-link link-object)) + (type (org-element-property :type link-object)) (path (org-element-property :path link-object)) (properties ;for link's visible part (list @@ -6001,7 +6002,7 @@ This includes angle, plain, and bracket links." 'font-lock-multiline t))) (org-remove-flyspell-overlays-in start end) (org-rear-nonsticky-at end) - (if (not (eq 'bracket type)) + (if (not (eq 'bracket style)) (add-text-properties start end properties) ;; Handle invisible parts in bracket links. (remove-text-properties start end '(invisible nil)) @@ -6019,7 +6020,7 @@ This includes angle, plain, and bracket links." (org-rear-nonsticky-at visible-end))) (let ((f (org-link-get-parameter type :activate-func))) (when (functionp f) - (funcall f start end path (eq type 'bracket)))) + (funcall f start end path (eq style 'bracket)))) (throw :exit t))))) ;signal success nil))