Use builtin key in Org capture template to insert link to clock

Seems more robust and is definitively more readable.
This commit is contained in:
Daniel Borchmann 2025-11-18 20:09:03 +01:00
parent a01c1b8fdd
commit e757dd6e1a
No known key found for this signature in database
GPG Key ID: 50EA937BF472ADD1

10
init.el
View File

@ -720,8 +720,6 @@ split horizontally again, but this extra work should not matter much."
db/org-insert-checklist db/org-insert-checklist
db/org-copy-body-from-item-to-point db/org-copy-body-from-item-to-point
db/org-find-links-to-current-item db/org-find-links-to-current-item
db/org-add-link-to-other-item
db/org-add-link-to-current-clock
hydra-org-linking/body hydra-org-linking/body
db/org-clock-goto-first-open-checkbox) db/org-clock-goto-first-open-checkbox)
:autoload (db/check-special-org-files-in-agenda :autoload (db/check-special-org-files-in-agenda
@ -1363,7 +1361,7 @@ accordingly."
(file db/org-default-refile-file) (file db/org-default-refile-file)
,(concat "* TODO [#B] %^{What}\n" ,(concat "* TODO [#B] %^{What}\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n" ":PROPERTIES:\n:CREATED: %U\n:END:\n"
"\nVia %(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer-string)))." "\nVia %K."
"%?") "%?")
:empty-lines-before 1 :empty-lines-before 1
:empty-lines-after 1) :empty-lines-after 1)
@ -1392,7 +1390,7 @@ accordingly."
entry entry
(file db/org-default-refile-file) (file db/org-default-refile-file)
,(concat "* GOTO [#B] %^{What} :DATE:\n%^{When}t\n" ,(concat "* GOTO [#B] %^{What} :DATE:\n%^{When}t\n"
"\nVia %(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer-string))).\n" "\nVia %K.\n"
"%?") "%?")
:empty-lines-before 1 :empty-lines-before 1
:empty-lines-after 1) :empty-lines-after 1)
@ -1401,7 +1399,7 @@ accordingly."
(file db/org-default-refile-file) (file db/org-default-refile-file)
,(concat "* DONE [#B] %^{What}\nCLOSED: %U\n" ,(concat "* DONE [#B] %^{What}\nCLOSED: %U\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n" ":PROPERTIES:\n:CREATED: %U\n:END:\n"
"\nInterrupted %(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer-string)))." "\nInterrupted %K."
"%?") "%?")
:clock-in t :clock-in t
:clock-resume t :clock-resume t
@ -1410,7 +1408,7 @@ accordingly."
("q" "Quick note" ("q" "Quick note"
plain plain
(function db/goto-quick-notes) (function db/goto-quick-notes)
"- [ ] %?" "- [ ] %?\n\n Via %K"
:empty-lines-before 1 :empty-lines-before 1
:empty-lines-after 1)))) :empty-lines-after 1))))