Allow to jump to template checklist instead of inserting it
This is a convenience shortcut. Maybe the code to insert the complete checklist also needs to go into another function, for implementatio clarity. Do this as soon as it seems appropriate or necessary.
This commit is contained in:
parent
4e10c06799
commit
ddbcfee3d9
|
@ -875,7 +875,7 @@ determined."
|
|||
;; Return `template-marker', which is either `nil' or a marker.
|
||||
template-marker))
|
||||
|
||||
(defun db/org-insert-checklist ()
|
||||
(defun db/org-insert-checklist (arg)
|
||||
"Insert checklist for Org Mode item at point.
|
||||
|
||||
The checklist consists of a listing of relevant backlinks of the
|
||||
|
@ -917,13 +917,23 @@ determined by the TEMPLATE_ID property, which must be an ID
|
|||
referencing the proper template item. If that property is not
|
||||
set, search for the topmost sibling of the current item is
|
||||
conducted to see whether its headline is matching
|
||||
\"^Template.*\"; if so, its body is used as template."
|
||||
(interactive)
|
||||
\"^Template.*\"; if so, its body is used as template.
|
||||
|
||||
When ARG is given, jump to the current template instead of
|
||||
inserting the checklist."
|
||||
(interactive "P")
|
||||
|
||||
(unless (derived-mode-p 'org-mode)
|
||||
(user-error "Not in Org mode, aborting"))
|
||||
|
||||
;; Insert relevant backlinks, when available.
|
||||
(cond (arg
|
||||
;; Universal argument given, just jump to the checklist of the item at
|
||||
;; point.
|
||||
(db/org-goto-checklist-item-of-point))
|
||||
|
||||
(t
|
||||
;; Default action: insert complete checklist. Start with inserting
|
||||
;; relevant backlinks, when available.
|
||||
(let ((parent-depth (--when-let (org-entry-get (point) "CHECKLIST_BACKLINK_DEPTH" nil)
|
||||
(string-to-number it)))
|
||||
number-of-backlinks
|
||||
|
@ -961,7 +971,7 @@ conducted to see whether its headline is matching
|
|||
(if (not template-marker)
|
||||
(insert " none.")
|
||||
(insert "\n")
|
||||
(db/org-copy-body-from-item-to-point template-marker))))
|
||||
(db/org-copy-body-from-item-to-point template-marker))))))
|
||||
|
||||
(define-obsolete-function-alias 'db/org-copy-template
|
||||
'db/org-insert-checklist
|
||||
|
|
Loading…
Reference in New Issue