summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-09-25 16:04:51 +0200
committerBastien Guerry <bzg@altern.org>2012-09-25 16:04:51 +0200
commit50091a849ed819172aaa51f5fe3b8f64e36f34e8 (patch)
tree422e7d3157f3e9142d9ccc4a8de813a78796c123
parent1e6263354eec3b4d16a1abe4641224dfe945502d (diff)
downloadorg-mode-50091a849ed819172aaa51f5fe3b8f64e36f34e8.tar.gz
org.el: Add a 'htmlize-link text property to plain and bracket links
* org.el (org-activate-plain-links) (org-activate-bracket-links): Add a new 'htmlize-link text property, so that htmlize (> version 1.42) can linkify the links. Thanks to Hrvoje Nikšić for suggesting this.
-rw-r--r--lisp/org.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/lisp/org.el b/lisp/org.el
index ec2652b..5ee7213 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5435,16 +5435,18 @@ will be prompted for."
(defun org-activate-plain-links (limit)
"Run through the buffer and add overlays to links."
(catch 'exit
- (let (f)
+ (let (f hl)
(when (re-search-forward (concat org-plain-link-re) limit t)
(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
(setq f (get-text-property (match-beginning 0) 'face))
+ (setq hl (org-match-string-no-properties 0))
(if (or (eq f 'org-tag)
(and (listp f) (memq 'org-tag f)))
nil
(add-text-properties (match-beginning 0) (match-end 0)
(list 'mouse-face 'highlight
'face 'org-link
+ 'htmlize-link `(:uri ,hl)
'keymap org-mouse-map))
(org-rear-nonsticky-at (match-end 0)))
t))))
@@ -5625,17 +5627,19 @@ by a #."
(defun org-activate-bracket-links (limit)
"Run through the buffer and add overlays to bracketed links."
(if (re-search-forward org-bracket-link-regexp limit t)
- (let* ((help (concat "LINK: "
- (org-match-string-no-properties 1)))
- ;; FIXME: above we should remove the escapes.
- ;; but that requires another match, protecting match data,
- ;; a lot of overhead for font-lock.
+ (let* ((hl (org-match-string-no-properties 1))
+ (help (concat "LINK: " hl))
+ ;; FIXME: Above we should remove the escapes. But that
+ ;; requires another match, protecting match data, a lot
+ ;; of overhead for font-lock.
(ip (org-maybe-intangible
(list 'invisible 'org-link
'keymap org-mouse-map 'mouse-face 'highlight
- 'font-lock-multiline t 'help-echo help)))
+ 'font-lock-multiline t 'help-echo help
+ 'htmlize-link `(:uri ,hl))))
(vp (list 'keymap org-mouse-map 'mouse-face 'highlight
- 'font-lock-multiline t 'help-echo help)))
+ 'font-lock-multiline t 'help-echo help
+ 'htmlize-link `(:uri ,hl))))
;; We need to remove the invisible property here. Table narrowing
;; may have made some of this invisible.
(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))