Archived
1
0
Fork 0

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

This commit is contained in:
KemoNine 2022-09-02 12:57:41 -04:00
parent 51ee49b12b
commit 4a1e66cd2c

View file

@ -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://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 ; https://stackoverflow.com/questions/25437069/how-can-i-mark-org-habits-as-done-in-the-past
(defun kmn/org-habit-with-date (&optional arg) (defun kmn/org-habit-with-date (&optional arg)
(interactive "P") (interactive "P")
(setq my-activation-time (current-time))
(cl-letf* ((org-read-date-prefer-future nil) (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) ((symbol-function 'current-time)
#'(lambda () my-current-time)) #'(lambda () my-current-time))
((symbol-function 'org-today) ((symbol-function 'org-today)
@ -38,9 +43,9 @@
(funcall super-org-entry-put pom property my-value)) (funcall super-org-entry-put pom property my-value))
(funcall super-org-entry-put pom property 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) )
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;