3

I can start emacs with my org-mode agenda view by putting the following in my init.el file:

(org-agenda-list)
(delete-other-windows)

Or I can start it with my global todo list:

(org-todo-list)
(delete-other-windows)

But not both. I can define a custom view like so:

(add-to-list
 'org-agenda-custom-commands
 '("z" "calendar + todo"
   ((agenda "")
    (todo ""))))

But how can I start emacs with this custom view loaded?

2
  • If you type C-h f aka M-x describe-function, you can look up org-agenda-list and see what the optional arguments are. You can then experiment by calling that function with your custom arguments, including, but not limited to let-binding certain applicable variables ...
    – lawlist
    Apr 13, 2020 at 6:07
  • The arguments of org-agenda-list are (&optional ARG START-DAY SPAN WITH-HOUR). There doesn't seem to be anything related to TODOs in there. Am I missing something?
    – AEmacs
    Apr 13, 2020 at 8:08

2 Answers 2

4

You can start it with

(org-agenda nil "z")

Read more about this function by M-x describe-function, org-agenda

(org-agenda &optional ARG ORG-KEYS RESTRICTION)
0

Although your method works just fine, it still loads the splash screen and executes an additional command which is not very efficient in my opinion. So I wanted to add this as a solution:

(setq inhibit-splash-screen t)
(add-hook 'after-init-hook #'(lambda ()
                               (let ((org-agenda-window-setup 'only-window))
                                 (org-agenda nil "z"))))

This code omits the Emacs splash screen and then adds a lambda function to the the hook that is executed after Emacs has been initialized. The lambda function temporarily replaces the variable that tells org agenda how to setup its window, which makes display as the only window. Finally, org custom agenda view is called using the function mentioned by @cauchy-cai

PS: Sorry if this reply doesn't focus on the question, I wanted to comment but I don't meet the minimum required reputation to do so.

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.