0

I have a personal orgmode file where I organize my life. Always when I open it I have to press:

C-c a a

That opens my agenda and shows to me my habits, the scheduled and deadline tasks. But it's annoying to remember it and make manually. I'd like to open my orgmode file and automatically opens my agenda overview.

3

You can use file variables (or in this case, a pseudo-variable) to do something when you open a particular file. Add something like this at the bottom of the file:

# Local Variables:
# eval: (progn (org-agenda-list) (split-window-below))
# End:

In order to avoid confirmation questions, you'll also have to set a couple of variables in your init file:

(setq enable-local-eval t)
(setq safe-local-eval-forms '((progn (org-agenda-list) (split-window-below))))

I still find this annoying because the agenda splits the window and so I end up with two small windows: one for the file and one for the agenda (in addition to the window that I started with). But if I don't split the window, then the file gets opened in the agenda window and hides it. Despite that, I hope this helps.

Update: A better alternative

Here's a slightly different method, using other-window to switch windows between opening the agenda and opening the file. The variable settings are like this:

(setq enable-local-eval t)
(setq safe-local-eval-forms '((progn (org-agenda-list) (other-window 1))))

and the file-locals section in the file itself becomes:

# Local Variables:
# eval: (progn (org-agenda-list) (other-window 1))
# End:

I think this behaves better and in the few tests I did (with just a couple of windows), it seemed robust. I'm not sure whether I would like it if I had a lot of windows open however.

4
  • The window split is really annoying. No way to get ride of it? XD Thank you so much anyway! – Felipe May 7 '20 at 19:45
  • Probably there is, but it is going to be more complicated than what I came up with. I agree that it is annoying, but I couldn't think of anything simple to improve the situation. If I do, I'll edit the answer. – NickD May 7 '20 at 20:06
  • See if you like this better. – NickD May 7 '20 at 20:21
  • NickD, much better! Before I had 2 divisions (3 parts). Now I have just one (two parts). Not ideal yet, but one hundred times better. Thank you again. Congrats! Great idea. – Felipe May 8 '20 at 19:19

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.