Add function to jump to first open checkbox in subtree
Still needs a nice key binding.
This commit is contained in:
parent
63a03f0038
commit
5479efabee
3
init.el
3
init.el
@ -766,7 +766,8 @@
|
||||
db/org-add-link-to-other-item
|
||||
db/org-add-link-to-current-clock
|
||||
hydra-org-linking/body
|
||||
org-dblock-write:db/org-backlinks))
|
||||
org-dblock-write:db/org-backlinks
|
||||
db/org-goto-first-open-checkbox-in-subtree))
|
||||
|
||||
(use-package org
|
||||
:pin "gnu"
|
||||
|
||||
@ -759,6 +759,24 @@ cache if that's in use."
|
||||
(when (derived-mode-p 'org-agenda-mode)
|
||||
(org-agenda-redo)))
|
||||
|
||||
(defun db/org-goto-first-open-checkbox-in-subtree ()
|
||||
"Jump to first open checkbox in the current subtree.
|
||||
|
||||
First search for started checkboxes, i.e. [-], and if those are
|
||||
not found, go to the first open checkbox, i.e. [ ].
|
||||
|
||||
If there's no such open checkbox, emit a message and stay put."
|
||||
(interactive)
|
||||
(unless (derived-mode-p 'org-mode)
|
||||
(user-error "Not in Org buffer, exiting"))
|
||||
(save-restriction
|
||||
(widen)
|
||||
(org-back-to-heading 'invisible-ok)
|
||||
(org-narrow-to-subtree)
|
||||
(unless (or (re-search-forward "\\[-\\]" nil 'no-error)
|
||||
(re-search-forward "\\[ \\]" nil 'no-error))
|
||||
(message "No open checkbox in subtree"))))
|
||||
|
||||
|
||||
;;; Calendar
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user