瀏覽代碼

Merge branch 'maint'

Nicolas Goaziou 9 年之前
父節點
當前提交
7125fa1947
共有 1 個文件被更改,包括 8 次插入9 次删除
  1. 8 9
      lisp/org.el

+ 8 - 9
lisp/org.el

@@ -24923,17 +24923,16 @@ when non-nil, is a regexp matching keywords names."
 		 (when (derived-mode-p 'org-mode)
 		   (org-show-context 'org-goto))))))
 
-(defun org-link-display-format (link)
-  "Replace a link with its the description.
+(defun org-link-display-format (s)
+  "Replace links in string S with their description.
 If there is no description, use the link target."
   (save-match-data
-    (if (string-match org-bracket-link-analytic-regexp link)
-	(replace-match (if (match-end 5)
-			   (match-string 5 link)
-			 (concat (match-string 1 link)
-				 (match-string 3 link)))
-		       nil t link)
-      link)))
+    (replace-regexp-in-string
+     org-bracket-link-analytic-regexp
+     (lambda (m)
+       (if (match-end 5) (match-string 5 m)
+	 (concat (match-string 1 m) (match-string 3 m))))
+     s nil t)))
 
 (defun org-toggle-link-display ()
   "Toggle the literal or descriptive display of links."