1

I sync my org files between multiple devices with a Dropbox-like service. When a change is synced to a computer1 that already has Emacs running, org-todo-list subsequently shows stale headings.

I am unable to refresh the list by either

  1. Performing a new search (e.g. '0 r'), or
  2. Calling org-agenda-redo

The only thing that's gotten the headings to update is to either

  1. Open one of the .org files in question in Emacs, which immediately updates all of the headings for that file (only) in the todo list, or
  2. Restart Emacs, including the daemon if applicable

Option 1 is tedious because there may be many files to update and I might not remember which ones. Option 2 is slow and inconvenient depending on what else I have going on at the moment.

Is there a way to configure org-mode to watch for filesystem changes? Is there a command to trigger a hard refresh? If not, how might I create one?


1 This problem happens for me on Linux and macOS, and I'm able to reproduce it without any sync tool; that is, I observe the same behavior if I edit a file locally with anything but Emacs.

1 Answer 1

2

I do this:

(add-hook 'org-mode-hook #'auto-revert-mode)

This will cause emacs to detect any changes to the files underlying an org buffer and update the buffer by re-reading from disc. See the docs for auto-revert-mode for more.

6
  • Please elaborate your answer a bit, telling how you think it answers the question.
    – Drew
    Mar 5, 2022 at 22:35
  • OK: elaborated. Mar 5, 2022 at 23:42
  • 1
    Strictly speaking, it's only needed for Org agenda files, not every Org mode file.
    – NickD
    Mar 5, 2022 at 23:51
  • Adding this hook to my config made it so that searching again would pick up on changes to files I had in an Emacs buffer, but not others. So, marginally helpful, but if I want an accurate summary of the (dozens of) files I don't necessarily have open, I'm still stuck with restarting.
    – billkw
    Mar 7, 2022 at 2:08
  • If you have run an agenda command, then all of the files that contribute to the agenda (the list is returned by calling the function org-agenda-files ) are open. So I'm not sure what "(dozens of) files I don't necessarily have open" you are talking about. auto-revert automatically reverts the buffer from the corresponding file: when the underlying file changes, the buffer changes. You still might need to press g in the agenda buffer to refresh the agenda.
    – NickD
    Mar 7, 2022 at 17:58

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.