I have been able to initialize org agenda on Emacs startup with:

(add-hook 'emacs-startup-hook 'org-agenda-list)

However, now I want to initialize org agenda directly with log mode, and I haven't been able to figure out how to do it.

Attempting to write

(add-hook 'emacs-startup-hook 'org-agenda-start-with-log-mode '(closed clock))

resulted in an Emacs error about the symbol org-agenda-start-with-log-mode being void. I guess it's because org-mode related functions haven't been completely loaded yet on Emacs startup.

However, attempts to run it after org has been loaded have also failed:

(eval-after-load 'org-agenda
  '(org-agenda-start-with-log-mode '(closed clock)))

Is there a way to achieve what I want?


org-agenda-list is a function, but org-agenda-start-with-log-mode is just a variable. What you appear to want to do is call org-agenda-list with a certain value for org-agenda-start-with-log-mode. You can do this is as follows:

(add-hook 'emacs-startup-hook
      (lambda ()
        (let ((org-agenda-start-with-log-mode '(closed clock)))

with the let clause creating a local binding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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