From 8e03bcff641bd0d520d425f311e503102e4dc953 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 30 Aug 2023 09:50:52 -0600 Subject: [PATCH] [Emacs] Don't repeat to today when existing completion (org-window-habit) --- dotfiles/emacs.d/load.d/org-window-habit.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dotfiles/emacs.d/load.d/org-window-habit.el b/dotfiles/emacs.d/load.d/org-window-habit.el index bc78d8ca..cd5839c0 100644 --- a/dotfiles/emacs.d/load.d/org-window-habit.el +++ b/dotfiles/emacs.d/load.d/org-window-habit.el @@ -508,9 +508,20 @@ for actual-completions = (- end-index start-index) for expected-completions = actual-completions for actual-start = (org-window-habit-time-max effective-start start-time) - for proportion = (org-window-habit-duration-proportion start-time end-time actual-start) + for proportion = + (org-window-habit-duration-proportion start-time end-time actual-start) for required = (* proportion (oref habit repetitions-required)) - until (< expected-completions required) + for interval-start-time = + (org-window-habit-keyed-duration-add-plist + end-time (oref habit window-decrement-plist)) + for (interval-start-index interval-end-index) = + (org-window-habit-get-completion-window-indices + habit interval-start-time end-time + :start-index start-index + :end-index end-index + :reverse t) + for interval-has-completion = (not (eq interval-start-index interval-end-index)) + until (and (not interval-has-completion) (< expected-completions required)) for (new-start-time new-end-time) = (org-window-habit-advance-window habit start-time end-time) do