[Emacs] Do org-window-habit repeats after logging the state change in logbook

This commit is contained in:
Ivan Malison 2023-08-29 15:00:05 -06:00
parent f4485e2070
commit 96b2252a9f

View File

@ -539,13 +539,18 @@
(org-schedule nil target-time-string))) (org-schedule nil target-time-string)))
(defun org-window-habit-auto-repeat-maybe-advice (orig &rest args) (defun org-window-habit-auto-repeat-maybe-advice (orig &rest args)
(apply orig args) (let ((res (apply orig args)))
(when (and org-window-habit-mode (org-is-habit-p)) (when (and org-window-habit-mode (org-is-habit-p))
(apply 'org-window-habit-auto-repeat args))) (apply 'org-window-habit-auto-repeat args))
res))
(advice-add 'org-auto-repeat-maybe (advice-add 'org-auto-repeat-maybe
:around 'org-window-habit-auto-repeat-maybe-advice) :around 'org-window-habit-auto-repeat-maybe-advice)
;; This seems to be the actually important annotation
(advice-add 'org-add-log-note
:around 'org-window-habit-auto-repeat-maybe-advice)
(defun org-window-habit-insert-consistency-graphs (&optional line) (defun org-window-habit-insert-consistency-graphs (&optional line)
"Insert consistency graph for any habitual tasks." "Insert consistency graph for any habitual tasks."
(let ((inhibit-read-only t) (let ((inhibit-read-only t)