So, I finally decided to open the emacs lisp manual and figure it out myself. I wrote this bit of code that seems to work just fine! :)
;; Save the org-agenda for display with conky (defadvice org-todo-list (after saveorgagenda activate) "save this output to my todo file" (get-buffer-create "todo") (with-current-buffer "todo" (set-buffer-modified-p nil)) (kill-buffer "todo") (write-file "~/todo"))
EDIT REASONS:
1) Without kill-buffer, the defadvice creates a new todo buffer each time the org-todo list is executed. This is annoying.
2) Without the get-buffer-create function, kill buffers are not executed the first time, because at this moment there is no buffer named todo.
3) Without set-buffer-modified-p, the function will continue to tell you that "todo buffer is modified. Do you really want to kill it? (Y or n)" that would really defeat the whole target.
Phew! I am so happy that I actually took the time and effort to figure it out !: D
source share