Update function name and docstring for Org template copy function

We are now not merely copying a template from another item, but more abstractly
insert a checklist consisting of backlinks and a template.  Update docstring and
function name to reflect that, but keep the old name of `db/org-copy-template`
as an obsolete alias.
This commit is contained in:
Daniel Borchmann 2022-10-09 11:22:36 +02:00
parent 564990a1af
commit 754e22dc77
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625
3 changed files with 20 additions and 9 deletions

View File

@ -759,6 +759,7 @@
db/find-csv-in-org db/find-csv-in-org
db/org-mark-current-default-task db/org-mark-current-default-task
db/export-diary db/export-diary
db/org-insert-checklist
db/org-copy-template db/org-copy-template
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

View File

@ -149,7 +149,7 @@ in the main agenda view."
("Info Lookup" ?I counsel-info-lookup-symbol) ("Info Lookup" ?I counsel-info-lookup-symbol)
("Unicode Lookup" ?U counsel-unicode-char) ("Unicode Lookup" ?U counsel-unicode-char)
("Timeline of Day" ?T timeline-tools-format-timeline-of-day) ("Timeline of Day" ?T timeline-tools-format-timeline-of-day)
("Copy template to point" ?C db/org-copy-template)) ("Copy template to point" ?C db/org-insert-checklist))
"Mapping of frequently used features to functions implementing "Mapping of frequently used features to functions implementing
them. Can be used in application shortcuts such as them. Can be used in application shortcuts such as
`db/helm-shortcuts. Each entry is a list of three items: a `db/helm-shortcuts. Each entry is a list of three items: a

View File

@ -831,16 +831,22 @@ Work task and home task are determined by the current values of
org-home-task-id)) org-home-task-id))
(org-clock-mark-default-task)))) (org-clock-mark-default-task))))
(defun db/org-copy-template () (defun db/org-insert-checklist ()
"Copy template for the current Org Mode item to point. "Insert checklist for Org Mode item at point.
The template is determined by the TEMPLATE_ID property, which
must be an ID referencing the proper template item. If that The checklist consists of a listing of all backlinks to the
property is not set, search for the topmost sibling of the current item and its parents (without archives) as well as a
current item and see whether its headline is matching template. The template is determined by the TEMPLATE_ID
\"^Template.*\"; if so, use its body as template, and barf property, which must be an ID referencing the proper template
otherwise." item. If that property is not set, search for the topmost
sibling of the current item and see whether its headline is
matching \"^Template.*\"; if so, use its body as template, and
barf otherwise."
(interactive) (interactive)
(unless (derived-mode-p 'org-mode)
(user-error "Not in Org mode, aborting"))
(let (template-pom) (let (template-pom)
;; Check for TEMPLATE_ID property ;; Check for TEMPLATE_ID property
@ -877,6 +883,10 @@ otherwise."
(insert "\n\nTemplate:\n") (insert "\n\nTemplate:\n")
(db/org-copy-body-from-item-to-point template-pom))) (db/org-copy-body-from-item-to-point template-pom)))
(define-obsolete-function-alias 'db/org-copy-template
'db/org-insert-checklist
"2022-10-09")
(defun db/org-copy-body-from-item-to-point (pom) (defun db/org-copy-body-from-item-to-point (pom)
"Copy body from item given by POM to point. "Copy body from item given by POM to point.
This can be used to copy checklists from templates to the current This can be used to copy checklists from templates to the current