4

Org agenda supports a powerful exporting function (org-agenda-write), which exports your agenda view to pdf, ps, html.. format beautifully. In this post, I hope to make that process automatically.

More specifically, I'd like to have a cron job that handles everything. A function (org-store-agenda-views) that comes close is described in the same link above. However, after tinkering for two hours, I still can't find what I want.

Currently, I have to do it manually:

  1. Enter org agenda.
  2. Launch log view, so I can see exactly how the entries are clocked.
  3. Launch clock report mode, so I get a nice time summary table.
  4. Fire (org-agenda-write).

As my attempt to do it automatically, I've tried

  (setq org-agenda-custom-commands
    '(("X" "EXPORT" ((agenda "" ((org-agenda-span 7)
                                 (org-agenda-log-mode-items '(closed clock state))
                                 (org-agenda-clockreport-mode t)
                                 (org-agenda-start-on-weekday 0))
                    )) nil (("~/agenda.html" "~/agenda.pdf"))))

as in the link. Notice that org-agenda-log-mode-items and org-agenda-clockreport-mode are the two closest variables I've found. But it did not affect the generated file..

Question

How to generate a full clocked agenda view automatically?

1 Answer 1

1

Setting org-agenda-log-mode-items only affects what items get shown when log mode is on but doesn't turn on log mode. To do that also set org-agenda-start-with-log-mode to t:

  (setq org-agenda-custom-commands
    '(("X" "EXPORT" ((agenda "" ((org-agenda-span 7)
                                 (org-agenda-start-with-log-mode t)
                                 (org-agenda-log-mode-items '(closed clock state))
                                 (org-agenda-clockreport-mode t)
                                 (org-agenda-start-on-weekday 0))
                    )) nil (("~/agenda.html" "~/agenda.pdf"))))
1
  • It does not change the exported file. However, by evaluating (setq org-agenda-start-with-log-mode t) first, the exported file changed! Thank you! But this does not work for (setq org-agenda-start-with-clockreport-mode t). I'm still looking for a solution.
    – Student
    Commented Apr 22, 2020 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.