summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-08-19 16:56:52 +0200
committerBastien Guerry <bzg@altern.org>2012-08-19 16:56:52 +0200
commitad35e2ac6c6decae55dd987be738e07e7c87bd7d (patch)
tree96f9600bdcd352586aa0e23d94cfaff427e82ac5
parentbb895827c2009028a000f6c04afce390f082a38c (diff)
downloadorg-mode-ad35e2ac6c6decae55dd987be738e07e7c87bd7d.tar.gz
org.el: Don't activate a plain link when it is part of a bracketed link
* org.el (org-activate-plain-links): Don't activate a plain link when it is part of a bracketed link, unless bracketed links are not enlisted in `org-activate-links'. (org-open-at-point): Don't consider the text immediately after a bracketed link is part of a plain link. This fixes a bug when fontifying [[http://orgmode.org][Org]]Mode -- where "Mode" should not be fontified, because it is not part of the bracketed link. Note that there was another related bug: C-c C-o on "Mode" used to try opening a plain link. Also fixed in this commit.
-rw-r--r--lisp/org.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 5e7807d..e7c6223 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5450,7 +5450,12 @@ will be prompted for."
"Run through the buffer and add overlays to links."
(catch 'exit
(let (f)
- (if (re-search-forward org-plain-link-re limit t)
+ (if (and (re-search-forward (concat org-plain-link-re) limit t)
+ (or (not (member 'bracket org-activate-links))
+ (save-excursion
+ (save-match-data
+ (goto-char (match-beginning 0))
+ (not (looking-back "\\[\\["))))))
(progn
(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
(setq f (get-text-property (match-beginning 0) 'face))
@@ -9780,7 +9785,8 @@ application the system uses for this file type."
(save-excursion
(when (or (org-in-regexp org-angle-link-re)
- (org-in-regexp org-plain-link-re))
+ (and (goto-char (car (org-in-regexp org-plain-link-re)))
+ (save-match-data (not (looking-back "\\[\\[")))))
(setq type (match-string 1)
path (org-link-unescape (match-string 2)))
(throw 'match t)))