I am trying to rebuild my Org Agenda buffer with a timer. I am trying to do it like this:
(defun renewOrgBuffer ()
(interactive)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(when (derived-mode-p 'org-agenda-mode)
(org-agenda-redo t))))
)
(run-with-idle-timer 60 1000 #'renewOrgBuffer)
I basically swiped this from another answer but they wanted to do somehting when the org file saved. I want to update it with a timer and am running into errors.
When I just run the function in ielm
I get the error: *** Eval error *** ‘recenter’ing a window that does not display current-buffer.
I am running Emacs 25.1.50.2 client connected to a daemon with org verion 8.2.10 on Ubuntu 15.10.
The purpose for this for me is that I like to have my org file with my todos and appointments up in one buffer and the Org Agenda buffer up next to it. So the the main purpose for me to update the Org Agenda buffer is just so that the line that says now - - - - -
updates. It is a small think but I just want to figure it out.
Any help or pointers is appreciated.
Edit March 7
I have found that if you enable the sticky agenda view from the dispatcher (* option) then I can call my previously defined renewOrgBuffer
function interactively with M-x and instead of getting an error, I get a message in the mini buffer that says "org-agenda-list: ‘recenter’ing a window that does not display current-buffer.", which is great, but I don't want to call it interactively every time.
When I try to run that function from the scratch buffer or on a timer like
(run-with-idle-timer 3 1000 #'renewOrgBuffer)
I get the error:
Rebuilding agenda buffer...done
Error running timer ‘renewOrgBuffer’: (error "‘recenter’ing a window that does not display current-buffer.")
Although it says "Rebuilding agenda buffer...done" it does not actually rebuild it.
Any help with this added information would be helpful, Thank you.