diff options
author | John Kitchin <jkitchin@andrew.cmu.edu> | 2016-07-05 10:21:08 -0400 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-07-18 22:47:48 +0200 |
commit | b4dd8245b7d3e3e4106c77b846b07e167e2b30d5 (patch) | |
tree | d760007ab8a8d7029a9ccd4940c46ef29def470c | |
parent | de6858f293bcc5b98c9fdde2f5a112d87c017723 (diff) | |
download | org-mode-b4dd8245b7d3e3e4106c77b846b07e167e2b30d5.tar.gz |
Update `org-activate-plain-links'
* lisp/org.el (org-activate-plain-links): Use `org-link-parameters' to
create the link properties.
-rw-r--r-- | lisp/org.el | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el index 0b4954e..9e739c4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5928,17 +5928,57 @@ prompted for." "Add link properties for plain links." (when (and (re-search-forward org-plain-link-re limit t) (not (org-in-src-block-p))) - (let ((face (get-text-property (max (1- (match-beginning 0)) (point-min)) - 'face)) - (link (match-string-no-properties 0))) + + (let* ((face (get-text-property (max (1- (match-beginning 0)) (point-min)) + 'face)) + (link (match-string-no-properties 0)) + (type (match-string-no-properties 1)) + (path (match-string-no-properties 2)) + (link-start (match-beginning 0)) + (link-end (match-end 0)) + (link-face (org-link-get-parameter type :face)) + (help-echo (org-link-get-parameter type :help-echo)) + (htmlize-link (org-link-get-parameter type :htmlize-link)) + (activate-func (org-link-get-parameter type :activate-func))) (unless (if (consp face) (memq 'org-tag face) (eq 'org-tag face)) (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) (add-text-properties (match-beginning 0) (match-end 0) - (list 'mouse-face 'highlight - 'face 'org-link - 'htmlize-link `(:uri ,link) - 'keymap org-mouse-map)) + (list + 'mouse-face (or (org-link-get-parameter type :mouse-face) + 'highlight) + 'face (cond + ;; A function that returns a face + ((functionp link-face) + (funcall link-face path)) + ;; a face + ((facep link-face) + link-face) + ;; An anonymous face + ((consp link-face) + link-face) + ;; default + (t + 'org-link)) + 'help-echo (cond + ((stringp help-echo) + help-echo) + ((functionp help-echo) + help-echo) + (t + (concat "LINK: " + (save-match-data + (org-link-unescape link))))) + 'htmlize-link (cond + ((functionp htmlize-link) + (funcall htmlize-link path)) + (t + `(:uri ,link))) + 'keymap (or (org-link-get-parameter type :keymap) + org-mouse-map) + 'org-link-start (match-beginning 0))) (org-rear-nonsticky-at (match-end 0)) + (when activate-func + (funcall activate-func link-start link-end path nil)) t)))) (defun org-activate-code (limit) |