diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-06-05 23:39:42 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-06-05 23:39:42 +0200 |
commit | 439fcfbbf2215cc7fad8526d6fdbe3eb34d61bfe (patch) | |
tree | 68d535e5d65dde35eac740988ac462bc504f80e0 | |
parent | 82db669de6a4b7cd1f39bbf692a42c32a96ebb31 (diff) | |
download | org-mode-439fcfbbf2215cc7fad8526d6fdbe3eb34d61bfe.tar.gz |
Fix link fontification
* lisp/org.el (org-activate-links): Delegate to
`org-element-link-parser' to handle blanks and link expansion.
-rw-r--r-- | lisp/org.el | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lisp/org.el b/lisp/org.el index 6d545cd..2b2b863 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -137,6 +137,7 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-element-copy "org-element" (datum)) (declare-function org-element-interpret-data "org-element" (data)) (declare-function org-element-lineage "org-element" (blob &optional types with-self)) +(declare-function org-element-link-parser "org-element" ()) (declare-function org-element-nested-p "org-element" (elem-a elem-b)) (declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only)) (declare-function org-element-property "org-element" (property element)) @@ -5973,14 +5974,11 @@ This includes angle, plain, and bracket links." (max (1- start) (point-min)) 'face))) (if (consp face) (memq 'org-tag face) (eq 'org-tag face)))))) - (let* ((link (pcase type ;extract URL part - (`plain (match-string-no-properties 0)) - (`angle (buffer-substring-no-properties - (1+ start) (1- end))) - (_ (match-string-no-properties 2)))) - (path (save-match-data - (and (string-match ":" link) ;remove type - (substring link (match-end 0))))) + (let* ((link-object (save-excursion + (goto-char start) + (save-match-data (org-element-link-parser)))) + (link (org-element-property :raw-link link-object)) + (path (org-element-property :path link-object)) (properties ;for link's visible part (list 'face (pcase (org-link-get-parameter type :face) @@ -5995,10 +5993,7 @@ This includes angle, plain, and bracket links." 'help-echo (pcase (org-link-get-parameter type :help-echo) ((and (pred stringp) echo) echo) ((and (pred functionp) echo) echo) - (_ (concat "LINK: " - (save-match-data - (org-link-unescape - (org-link-expand-abbrev link)))))) + (_ (concat "LINK: " link))) 'htmlize-link (pcase (org-link-get-parameter type :htmlize-link) ((and (pred functionp) f) (funcall f)) |