Sfoglia il codice sorgente

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.
Bastien Guerry 12 anni fa
parent
commit
ad35e2ac6c
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8 2
      lisp/org.el

+ 8 - 2
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)))