Selaa lähdekoodia

Preserve priority of #+TARGET over #+NAME when resolving a link

* lisp/org.el (org-link-search): Preserve priority of #+TARGET over
  #+NAME when resolving a link.  This reverts partially commit
  49b14b02247adeb945e748a670169ef9cdf8c237.
Nicolas Goaziou 12 vuotta sitten
vanhempi
commit
7f9893887e
1 muutettua tiedostoa jossa 9 lisäystä ja 2 poistoa
  1. 9 2
      lisp/org.el

+ 9 - 2
lisp/org.el

@@ -10631,11 +10631,18 @@ visibility around point, thus ignoring
 	(goto-char (point-min))
 	(and
 	 (re-search-forward
-	  (format "^[ \t]*#\\+\\(?:TARGET\\|NAME\\): %s"
-		  (regexp-quote s0)) nil t)
+	  (format "^[ \t]*#\\+TARGET: %s" (regexp-quote s0)) nil t)
 	 (setq type 'dedicated pos (match-beginning 0))))
       ;; Found an invisible target.
       (goto-char pos))
+     ((save-excursion
+	(goto-char (point-min))
+	(and
+	 (re-search-forward
+	  (format "^[ \t]*#\\+NAME: %s" (regexp-quote s0)) nil t)
+	 (setq type 'dedicated pos (match-beginning 0))))
+      ;; Found an element with a matching #+name affiliated keyword.
+      (goto-char pos))
      ((and (string-match "^(\\(.*\\))$" s0)
 	   (save-excursion
 	     (goto-char (point-min))