diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-04-26 18:58:01 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-04-26 18:58:01 +0200 |
commit | 00a8275c6263e1bed38bbaf6ddece2d80557b694 (patch) | |
tree | 4299bf704e44eeb5952b83e1d990f30b554b05ba | |
parent | 91ea3920df85f530a31a80d6ed300d318261aeee (diff) | |
download | org-mode-00a8275c6263e1bed38bbaf6ddece2d80557b694.tar.gz |
Fix links to elements with a name
* lisp/org.el (org-store-link): Properly handle elements with a NAME
keyword.
-rw-r--r-- | lisp/org.el | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el index cc4836a..075e8db 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9884,14 +9884,12 @@ active region." (buffer-file-name (buffer-base-buffer))))) ;; Add a context search string (when (org-xor org-context-in-file-links arg) - (let* ((ee (org-element-at-point)) - (et (org-element-type ee)) - (ev (plist-get (cadr ee) :value)) - (ek (plist-get (cadr ee) :key)) - (eok (and (stringp ek) (string-match "name" ek)))) + (let* ((element (org-element-at-point)) + (type (org-element-type element)) + (name (org-element-property :name element))) (setq txt (cond ((org-at-heading-p) nil) - ((and (eq et 'keyword) eok) ev) + (name) ((org-region-active-p) (buffer-substring (region-beginning) (region-end))))) (when (or (null txt) (string-match "\\S-" txt)) @@ -9900,7 +9898,7 @@ active region." (condition-case nil (org-make-org-heading-search-string txt) (error ""))) - desc (or (and (eq et 'keyword) eok ev) + desc (or name (nth 4 (ignore-errors (org-heading-components))) "NONE"))))) (if (string-match "::\\'" cpltxt) |