summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-12-22 19:39:03 +0100
committerBastien Guerry <bzg@altern.org>2012-12-22 19:39:03 +0100
commit1db82b269aa0a859e97d91c05f4a8836da040427 (patch)
tree249e8ffaeed2d4fde894343f99f7ff332c6adf04
parent12fd14b8584175a2f16a44f3acc7f884fe99bc84 (diff)
downloadorg-mode-1db82b269aa0a859e97d91c05f4a8836da040427.tar.gz
org.el: Don't add curly braces to bracket links within internal links
* org.el (org-store-link): When creating a link to a heading with a bracket link, don't escape this link with curly braces as the escaped link is not active anyway; use the description instead. If the headline only consists of a bracket link, add a star to the description so that the user knows this is an internal link. Thanks to Dave Abrahams for triggering this.
-rw-r--r--lisp/org.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/org.el b/lisp/org.el
index f7cb5fe..805d193 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9062,7 +9062,12 @@ part of Org's core."
(if (consp link) (setq cpltxt (car link) link (cdr link)))
(setq link (or link cpltxt)
desc (or desc cpltxt))
- (if (equal desc "NONE") (setq desc nil))
+ (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))))
(if (and (or (org-called-interactively-p 'any) executing-kbd-macro) link)
(progn