Open ParetoOptimalDev opened 10 months ago
Here is something that basically adds "next" habit functionality from the org-habit-stats-mode
buffer. I'm out of time but was meaning to make a function called "org-habit-stats-review" that opens the first habit.
This is all very hacky and likely not the best way, but hopefully it's a good starting point.
Code:
(define-minor-mode habits-review-mode
"Mode for reviewing habits."
:lighter " Review"
:keymap (let ((map (make-sparse-keymap)))
(define-key map (kbd "n") 'next-habit-and-show-stats)
map)
(init-habits-agenda-buffer)
(defun next-habit-and-show-stats ()
(interactive)
(init-habits-agenda-buffer)
(with-current-buffer "*Org Agenda(H:STYLE=\"habit\")*"
(if (progn (forward-line) (eobp))
(goto-char (point-min)))
(org-agenda-next-item 1)
(org-habit-stats-view-habit-at-point-agenda)))
(defun init-habits-agenda-buffer ()
(unless (get-buffer "*Org Agenda(H:STYLE=\"habit\")*")
(let ((org-agenda-sticky t)
(org-agenda-custom-commands
'(("H" "Habits" tags-todo "STYLE=\"habit\""
((org-agenda-overriding-header "*Habits Review*")
(org-agenda-sorting-strategy
'(todo-state-down effort-up category-keep)))))))
(org-agenda nil "H")
(next-habit-and-show-stats))))
)
(add-hook 'org-habit-stats-mode-hook 'habits-review-mode)
I think an easy way to implement this would be:
style=habit
org-habit-stats-view-habit-at-point-agenda
on itThe agenda you can get with just:
I'm not quite sure how to make a minor (err major?) mode to then use that agenda as I describe above.
Here is elisp code that demonstrates what I mean and works though: