summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-04-16 16:05:55 +0200
committerBastien Guerry <bzg@altern.org>2013-04-16 16:05:55 +0200
commit4f89c37ceaede6a2e97ee7ab0d8e8996eecdf406 (patch)
tree80c518d9458e976dfc70d544823c4d511c8dd58e
parent407a6acf4d615b38ce6c9ae87c441133f21abc2d (diff)
downloadorg-mode-4f89c37ceaede6a2e97ee7ab0d8e8996eecdf406.tar.gz
org.el (org-store-link): When a bracket link is found in a headline, use the link description or the link path
* org.el (org-store-link): When a bracket link is found in a headline, use the link description or the link path.
-rw-r--r--lisp/org.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el
index de03ac0..0afa3d9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9547,12 +9547,15 @@ active region."
(setq link (or link cpltxt)
desc (or desc cpltxt))
(cond ((equal desc "NONE") (setq desc nil))
- ((string-match org-bracket-link-regexp desc)
- (setq desc
- (replace-regexp-in-string
- org-bracket-link-regexp
- (concat "\\3" (if (equal (length (match-string 0 desc))
- (length desc)) "*" "")) desc))))
+ ((string-match org-bracket-link-analytic-regexp desc)
+ (let ((d0 (match-string 3 desc))
+ (p0 (match-string 5 desc)))
+ (setq desc
+ (replace-regexp-in-string
+ org-bracket-link-regexp
+ (concat (or p0 d0)
+ (if (equal (length (match-string 0 desc))
+ (length desc)) "*" "")) desc)))))
;; Return the link
(if (not (and (or (org-called-interactively-p 'any)