From 4a1e66cd2cf6385c5c35f652567e5862fba9a540 Mon Sep 17 00:00:00 2001 From: KemoNine Date: Fri, 2 Sep 2022 12:57:41 -0400 Subject: [PATCH] cleanup/solve the new code and setup for marking previous days as skipped while retaining them scheduled for today ; this is for help with health logging via habits --- org/config-org-agendas.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/org/config-org-agendas.el b/org/config-org-agendas.el index 39088e9..e6bfbaf 100644 --- a/org/config-org-agendas.el +++ b/org/config-org-agendas.el @@ -16,12 +16,17 @@ ) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; set org habit status for yesterday and schedule for today. this is to facilitate adding "skipped" log entries for better reporting and tracking of habits +; this assumes youre operating on daily habits ; https://emacs.stackexchange.com/questions/9433/how-to-make-org-prompt-for-a-timestamp-when-changing-state-of-a-todo/63809 ; https://stackoverflow.com/questions/25437069/how-can-i-mark-org-habits-as-done-in-the-past (defun kmn/org-habit-with-date (&optional arg) (interactive "P") + (setq my-activation-time (current-time)) (cl-letf* ((org-read-date-prefer-future nil) - (my-current-time (org-read-date t t nil "when:" nil nil nil)) + (org-popup-calendar-for-date-prompt nil) + (my-current-time (org-read-date t t nil "when:" nil "-1d" nil)) ((symbol-function 'current-time) #'(lambda () my-current-time)) ((symbol-function 'org-today) @@ -38,9 +43,9 @@ (funcall super-org-entry-put pom property my-value)) (funcall super-org-entry-put pom property value) )))) - (if (eq major-mode 'org-agenda-mode) (org-agenda-todo arg) (org-todo arg)) + (if (eq major-mode 'org-agenda-mode) (org-agenda-todo arg) (org-todo arg)) ) - (org-schedule arg (format-time-string "%Y-%m-%d")) + (if (eq major-mode 'org-agenda-mode) (org-agenda-schedule arg my-activation-time) (org-schedule arg my-activation-time) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;