1

I have written this crappy code (i cant really code) to save a split orgmode agenda views with different agenda views.

(defun z/buffers-restore-agenda-split   ()
 (interactive)    
 (org-agenda nil "a")
 (split-window-right)
 (org-agenda nil "ba")
 (split-window-below)
 (org-agenda nil "bb")
 )

the function does split the windows correctly yet all the views get the last option ("bb") instead of a different view in each window

any clue why this happens?

0
1

The problem is that the default behaviour of org-agenda is to replace the contents of the agenda buffer rather than making new agenda buffer. You can change this by setting the variable org-agenda-sticky:

Non-nil means agenda q key will bury agenda buffers. Agenda commands will then show existing buffer instead of generating new ones. When nil, ‘q’ will kill the single agenda buffer.

You can set this globally or just set it temporarily in your function using let:

(defun z/buffers-restore-agenda-split   ()
  (interactive)
  (let ((org-agenda-sticky t))
    (org-agenda nil "a")
    (split-window-right)
    (org-agenda nil "ba")
    (split-window-below)
    (org-agenda nil "bb")
    ))
4
  • perfect! this solves the issue – zeltak Jul 3 '16 at 13:07
  • for some reason i pressed the down button and it wont let me undo that. in anycase the answer is perfect and solved. hope admins can up-vote it – zeltak Jul 3 '16 at 15:01
  • You just have to wait a while before you can change your vote. – erikstokes Jul 3 '16 at 15:12
  • Upvoted for justice. – Nek Jun 7 '18 at 10:14

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.