From 8ff956b3a2fdf91a57a488739b82f666954b90a5 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 15 Mar 2022 23:09:46 -0700 Subject: [oni-org] Hide the body of the task marked as done --- oni-org/oni-org.el | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- cgit v1.2.3-54-g00ecf