emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] lisp/org-capture.el: use link ID's for %K


From: Kenny Ballou
Subject: [PATCH] lisp/org-capture.el: use link ID's for %K
Date: Mon, 11 Dec 2023 08:46:19 -0700

* 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
---
 etc/ORG-NEWS        | 6 ++++++
 lisp/org-capture.el | 8 +++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9328f333c..55ab2453c 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -539,6 +539,12 @@ 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 e482f667f..ee86a3ee0 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1675,11 +1675,9 @@ 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)
+                  (save-excursion
+                    (org-with-point-at org-clock-marker
+                      (substring-no-properties (org-store-link 
current-prefix-arg nil))))
                ""))
         (v-f (or (org-capture-get :original-file-nondirectory) ""))
         (v-F (or (org-capture-get :original-file) ""))

base-commit: 420ed4e0338d12e26c62d3666ca39e7cff323d05
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]