diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index ebb29ee..9049e95 100644 --- a/oni-org/oni-org.el +++ b/oni-org/oni-org.el @@ -466,6 +466,11 @@ also move point to the start of the heading." (oni-org-create-chapter-heading book-name chapter-name notes-file)) (oni-org-create-chapter-section chapter-name notes-file)))) +(defun oni-org-todo-maybe-hide-body () + "Hide the current outline body if ‘org-state’ is a DONE state." + (when (member org-state org-done-keywords) + (outline-hide-body))) + (setq org-todo-keywords '((sequence "TODO(t)" "WIP" "BLOCKED(b@)" "|" "DONE(d!)") (sequence "READ(r)" "READING(!)" "|" "FINISHED(!)" "STOPPED(@)") @@ -473,6 +478,8 @@ also move point to the start of the heading." (sequence "LISTEN(l)" "LISTENING" "|" "DONE(d!)") (sequence "|" "CANCELLED(c@)"))) +(add-hook 'org-after-todo-state-change-hook 'oni-org-todo-maybe-hide-body) + (setf (alist-get 'file org-link-frame-setup) 'find-file) (add-to-list 'org-modules 'org-habit)