Skip to content

feature request: org-habit-stats-review function #4

Description

@ParetoOptimalDev

I think an easy way to implement this would be:

  • create a sticky org agenda filtered to style=habit
  • display the first habit's stats by calling org-habit-stats-view-habit-at-point-agenda on it
  • hitting n will go to the next habit in the background, but user only sees next habits stats displayed

The agenda you can get with just:

(let ((org-agenda-sticky t) ;; avoid clobbering users org-agenda in use
        (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"))

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:

(defun next-habit-and-show-stats ()
  (interactive)
  (if (progn (next-line) (eobp))
      (goto-char (point-min)))
  (org-agenda-next-item 1)
  (org-habit-stats-view-habit-at-point-agenda))

(defun review-habits ()
  (interactive)
  (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))
  (with-current-buffer "*Org Agenda(H:STYLE=\"habit\")*"
    (next-habit-and-show-stats)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions