How to automatically save all org files after marking a repeating item as DONE in the org agenda? I'm using this to automatically save my org buffers after every change to TODO status:

(advice-add 'org-todo :after (η #'org-save-all-org-buffers))

(Where η ignores all arguments and calls the given function.)

This however doesn't work for repeating tasks, scheduled like this:

SCHEDULED: <2016-04-22 Fri +1d>

The org document is still modified after changing the state from TODO to DONE. I've tried a number of hook variables and methods, all without success.

  • Are you saying that the file does not get saved? Or just that it is still marked as modified after the change? Maybe you could try the hook org-trigger-hook instead of using advice.
    – nispio
    Apr 21, 2016 at 15:27
  • @nispio, Tried that, the org buffer is still modified even if I call org-save-all-buffers unconditionally in org-trigger-hook. May 26, 2017 at 8:45

1 Answer 1


OK, after some investigation it looks like after calling the org-todo, the Org mode tries to store some sort of a “note” using the org-store-log-note function. So the chain of events is roughly the following:

  • org-todo is called.
  • The advice runs org-save-all-org-buffers without problems, everything gets saved.
  • If it's a repeating task, org-store-log-note gets called, which edits the org file again leaving the buffer in a modified state.

Knowing that, the solutions is obvious—just add an :after advice to the org-store-log-note function. My current setup is thus:

(advice-add 'org-deadline       :after (η #'org-save-all-org-buffers))
(advice-add 'org-schedule       :after (η #'org-save-all-org-buffers))
(advice-add 'org-store-log-note :after (η #'org-save-all-org-buffers))
(advice-add 'org-todo           :after (η #'org-save-all-org-buffers))

This η thing is just a helper I defined:

(defmacro η (fnc)
  "Return function that ignores its arguments and invokes FNC."
  `(lambda (&rest _rest)
     (funcall ,fnc)))
  • This would be nice. I tried copying the lines and pasting them. But that 'η' character seems to causing prablem. When pasted, it shows is \267. How do I get 'η'?
    – deshmukh
    Dec 1, 2017 at 10:36
  • @deshmukh, I have added the definition of that eta helper, hope you find it helpful. (You can use whatever you like instead of η, it's not necessary to use a greek letter after all :-) Dec 2, 2017 at 14:46
  • Perfect. I changed η to xx-mu and it worked fine. Thanks. But still curious, how come the same character displays as η in your .emacs and as \267 in mine?
    – deshmukh
    Dec 4, 2017 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.