3

I'm trying to get the agenda to show a list of everything I have worked on the past week, and only that.

This is close, but it still shows the items that are scheduled, every day since their scheduled dateb:

  (add-to-list 'org-agenda-custom-commands
       '("w" "Weekly review" agenda ""
     ((org-agenda-span 8)
      (org-agenda-start-day "-7d")
      (org-agenda-start-with-log-mode '(state clock)))))

Using (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'todo)) does remove the scheduled items, but it also removes the started items in which I clocked and the recurring items which are to do at a future date. (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo '("TODO"))) inversely doesn't remove the started items in which I didn't clock.

It's possible to do exactly what I want interactively, as written in the emacs manual :

v l or v L or short l (org-agenda-log-mode) Toggle Logbook mode. […] When called with two prefix arguments C-u C-u, show only logging information, nothing else. […]

But I can't figure out how to make that happen with org-agenda-custom-commands. I had a look in the definition of org-agenda-log-mode and it seems that it's setting org-agenda-show-log to 'only, but the help about org-agenda-show-log warns to not set it directly and indeed this doesn't end up in log mode at all:

  (add-to-list 'org-agenda-custom-commands
       '("w" "Weekly review" agenda ""
     ((org-agenda-span 8)
      (org-agenda-start-day "-7d")
      (org-agenda-start-with-log-mode t)
      (org-agenda-show-log 'only)
      (org-agenda-log-mode-items '(state clock)))))

As a chronic procrastinator, the scheduled items significantly clutter the log view. So how could I go about showing only the log?

elyuku
  • 67
  • 7

1 Answers1

2

You're very close. If you check the doc of org-agenda-show-log(through C-h v org-agenda-show-log), you will see you should use org-agenda-start-with-log-mode. And here is the menu of choices of org-agenda-start-with-log-mode:

(defcustom org-agenda-start-with-log-mode nil
  "The initial value of log-mode in a newly created agenda window.
See `org-agenda-log-mode' and `org-agenda-log-mode-items' for further
explanations on the possible values."
  :group 'org-agenda-startup
  :group 'org-agenda-daily/weekly
  :type '(choice (const :tag "Don't show log items" nil)
         (const :tag "Show only log items" only)
         (const :tag "Show all possible log items" clockcheck)
         (repeat :tag "Choose among possible values for `org-agenda-log-mode-items'"
             (choice (const :tag "Show closed log items" closed)
                 (const :tag "Show clocked log items" clock)
                 (const :tag "Show all logged state changes" state)))))

Finally, this template works on my side:

  (add-to-list 'org-agenda-custom-commands
       '("w" "Weekly review" agenda ""
     ((org-agenda-span 8)
      (org-agenda-start-day "-7d")
      (org-agenda-start-with-log-mode 'only)
      (org-agenda-log-mode-items '(state clock)))))
NickD
  • 27,023
  • 3
  • 23
  • 42
Tianshu Wang
  • 1,724
  • 4
  • 7