summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2014-03-13 16:27:51 +0100
committerBastien Guerry <bzg@altern.org>2014-03-13 16:27:51 +0100
commit0cf58595d74798f0580ec08d8fff878085c11670 (patch)
tree3abb63b078ea0a21190675b0d25f1235579dcc3d
parent7f65ba52eed64a4402b39f46bc852c6fb1291884 (diff)
downloadorg-mode-0cf58595d74798f0580ec08d8fff878085c11670.tar.gz
org.el (org-store-link): Fix bugs
* org.el (org-store-link): Ensure desc is not nil before matching a regexp against it.
-rw-r--r--lisp/org.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/org.el b/lisp/org.el
index ec9718d..a6ab319 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9524,8 +9524,9 @@ active region."
;; Store a link using the ID at point
(setq link (condition-case nil
(prog1 (org-id-store-link)
- (setq desc (plist-get org-store-link-plist
- :description)))
+ (setq desc (or (plist-get org-store-link-plist
+ :description)
+ "")))
(error
;; Probably before first headline, link only to file
(concat "file:"
@@ -9586,9 +9587,9 @@ active region."
;; We're done setting link and desc, clean up
(if (consp link) (setq cpltxt (car link) link (cdr link)))
(setq link (or link cpltxt)
- desc (or desc cpltxt ""))
+ desc (or desc cpltxt))
(cond ((equal desc "NONE") (setq desc nil))
- ((string-match org-bracket-link-analytic-regexp desc)
+ ((and desc (string-match org-bracket-link-analytic-regexp desc))
(let ((d0 (match-string 3 desc))
(p0 (match-string 5 desc)))
(setq desc