0

I use some custom agendas for work and some for personal stuff. At the moment I load a huge set of custom agendas in org-agenda-custom-commands containing all agendas for work and for personal stuff. This clutters up the dispatcher.

When I define two different sets of custom agendas, one for work and one for personal, I can only load and access agendas of one set. But with home office, sometimes I need "work agendas" on my personal computer.

How can I write the configuration, that I can "add" sets of agendas to org-agenda-custom-commands if necessary, without completely replacing it with one set or the other?

2
  • It's not clear to me what you are asking: it seems that you want a way to change org-agenda-custom-commands to sometimes be the home commands, sometimes be the office commands and sometimes be both and that you have a way to choose which one of the three possibilities will apply at any particular moment. Is that what you are asking? – NickD May 10 at 13:37
  • @NickD Yes exactly. – breathe_in_breathe_out May 10 at 14:36
0

Only way I can think of is to use a function which sets the variable and then calls the dispatcher. Something like:

(defun my/org-agenda-dispatcher-PERSONAL ()
  (interactive)
  (setq org-agenda-custom-commands
        '(("1" "Week Agenda + All Tasks"
           ((agenda "w" ((org-agenda-span 'week)))
            (todo "TODO|LATER"
                  ((org-agenda-sorting-strategy '(todo-state-up))
                   (org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled)))
                  )))))
  (org-agenda))

(defun my/org-agenda-dispatcher-WORK ()
  (interactive)
  (setq org-agenda-custom-commands
        '(("1" "Today's Agenda + Priority Tasks"
           ((agenda "d" ((org-agenda-span 'day)))
            (todo "TODO"
                  ((org-agenda-sorting-strategy '(todo-state-up))
                   (org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled))))))))
  (org-agenda))

Then you just call your custom functions rather than the generic org-agenda command.

But you'd have to watch out for other commands which might rely on the org-agenda-custom-commands variable.

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.