summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Ballou <kb@devnulllabs.io>2023-12-11 21:32:18 -0700
committerIhor Radchenko <yantar92@posteo.net>2023-12-12 13:43:03 +0100
commitac8b925407b9aed87eacf76e72748c00faf8711c (patch)
tree64c2336feb5a03bcb353d2b3873352c7063c7fc9
parent676f46b7e206e10a2932126f842bbfb73d30d787 (diff)
downloadorg-mode-ac8b92540.tar.gz
lisp/org-capture.el: use `org-store-link' for %K values
* org-capture.el (org-capture-fill-template): fill %K values using link value from `org-store-link', which respects `org-id-link-to-use-id'. * doc/ORG-NEWS: (Template variable expansion %K) Document new behavior. Reported-by: Nathaniel W Griswold <nate@manicmind.earth> Signed-off-by: Kenny Ballou <kb@devnulllabs.io> Link: https://list.orgmode.org/EF459D47-FCA4-4A18-AFC7-3E62159F186C@manicmind.earth/ TINYCHANGE
-rw-r--r--etc/ORG-NEWS5
-rw-r--r--lisp/org-capture.el7
2 files changed, 7 insertions, 5 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9328f33..9858df0 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -539,6 +539,11 @@ Currently implemented options are:
tasks this technically violates the iCalendar spec, but some
iCalendar programs support this usage.
+*** Capture template expansion now supports ID links
+
+The capture template expansion element =%K= creates links using
+~org-store-link~, which respects the values of ~org-id-link-to-use-id~.
+
** New features
*** =ob-plantuml.el=: Support tikz file format output
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index e482f66..4bbe2c4 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1675,11 +1675,8 @@ Expansion occurs in a temporary Org mode buffer."
(org-no-properties org-clock-heading)
""))
(v-K (if (marker-buffer org-clock-marker)
- (org-link-make-string
- (format "%s::*%s"
- (buffer-file-name (marker-buffer org-clock-marker))
- v-k)
- v-k)
+ (org-with-point-at org-clock-marker
+ (org-store-link nil nil))
""))
(v-f (or (org-capture-get :original-file-nondirectory) ""))
(v-F (or (org-capture-get :original-file) ""))