diff options
author | Bastien Guerry <bzg@altern.org> | 2012-12-29 06:30:47 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-12-29 06:30:47 +0100 |
commit | 95096f14b6a0e75bf7316ed22e018ea6bef0711b (patch) | |
tree | 66417607d6e0b1dc0f53b1eb3ce3a649884b65f6 | |
parent | 9cf6800a95b318afa4cc50010448b1352adbf5b5 (diff) | |
download | org-mode-95096f14b6a0e75bf7316ed22e018ea6bef0711b.tar.gz |
org.el (org-store-link): Fix the naming of internal links to lines starting with a keyword
* org.el (org-store-link): Fix the naming of internal links to
lines starting with a keyword.
Thanks to Thomas S. Dye for reporting a related issue.
-rw-r--r-- | lisp/org.el | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/lisp/org.el b/lisp/org.el index e8bfd2b..4dd15d9 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9032,21 +9032,23 @@ part of Org's core." (buffer-file-name (buffer-base-buffer))))) ;; Add a context search string (when (org-xor org-context-in-file-links arg) - (let ((e (org-element-at-point))) + (let* ((ee (org-element-at-point)) + (et (org-element-type ee)) + (ev (plist-get (cadr ee) :value))) (setq txt (cond - ((org-at-heading-p) nil) - ((eq (org-element-type e) 'keyword) - (plist-get (cadr e) :value)) - ((org-region-active-p) - (buffer-substring (region-beginning) (region-end)))))) - (when (or (null txt) (string-match "\\S-" txt)) - (setq cpltxt - (concat cpltxt "::" - (condition-case nil - (org-make-org-heading-search-string txt) - (error ""))) - desc (or (nth 4 (ignore-errors - (org-heading-components))) "NONE")))) + ((org-at-heading-p) nil) + ((eq et 'keyword) ev) + ((org-region-active-p) + (buffer-substring (region-beginning) (region-end))))) + (when (or (null txt) (string-match "\\S-" txt)) + (setq cpltxt + (concat cpltxt "::" + (condition-case nil + (org-make-org-heading-search-string txt) + (error ""))) + desc (or (and (eq et 'keyword) ev) + (nth 4 (ignore-errors (org-heading-components))) + "NONE"))))) (if (string-match "::\\'" cpltxt) (setq cpltxt (substring cpltxt 0 -2))) (setq link cpltxt)))) |