forked from mirrors/org-mode
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.
This commit is contained in:
parent
9cf6800a95
commit
95096f14b6
14
lisp/org.el
14
lisp/org.el
|
@ -9032,21 +9032,23 @@ part of Org's core."
|
||||||
(buffer-file-name (buffer-base-buffer)))))
|
(buffer-file-name (buffer-base-buffer)))))
|
||||||
;; Add a context search string
|
;; Add a context search string
|
||||||
(when (org-xor org-context-in-file-links arg)
|
(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
|
(setq txt (cond
|
||||||
((org-at-heading-p) nil)
|
((org-at-heading-p) nil)
|
||||||
((eq (org-element-type e) 'keyword)
|
((eq et 'keyword) ev)
|
||||||
(plist-get (cadr e) :value))
|
|
||||||
((org-region-active-p)
|
((org-region-active-p)
|
||||||
(buffer-substring (region-beginning) (region-end))))))
|
(buffer-substring (region-beginning) (region-end)))))
|
||||||
(when (or (null txt) (string-match "\\S-" txt))
|
(when (or (null txt) (string-match "\\S-" txt))
|
||||||
(setq cpltxt
|
(setq cpltxt
|
||||||
(concat cpltxt "::"
|
(concat cpltxt "::"
|
||||||
(condition-case nil
|
(condition-case nil
|
||||||
(org-make-org-heading-search-string txt)
|
(org-make-org-heading-search-string txt)
|
||||||
(error "")))
|
(error "")))
|
||||||
desc (or (nth 4 (ignore-errors
|
desc (or (and (eq et 'keyword) ev)
|
||||||
(org-heading-components))) "NONE"))))
|
(nth 4 (ignore-errors (org-heading-components)))
|
||||||
|
"NONE")))))
|
||||||
(if (string-match "::\\'" cpltxt)
|
(if (string-match "::\\'" cpltxt)
|
||||||
(setq cpltxt (substring cpltxt 0 -2)))
|
(setq cpltxt (substring cpltxt 0 -2)))
|
||||||
(setq link cpltxt))))
|
(setq link cpltxt))))
|
||||||
|
|
Loading…
Reference in New Issue