2

I have my org files kept synchronized via rsync with various devices. These buffers are usually open in any running emacs instances due to agenda and capture. I want emacs to re-read these files from disk when something arrives via rsync. I know that auto-revert-mode handles this, but I want to enable it solely for files under my org directory.

How can I do this?

7

Funny: it looks like you choose a tag that directly answers your question ("directory-local-variables")

The best way to accomplish this is by placing a .dir-locals.el file in your org directory and using it to enable auto-revert-mode. Specifically, the file should look contain this:

((nil . ((eval . (auto-revert-mode 1)))))

If you want only org files to auto-revert, change nil to org-mode.

From the manual:

Sometimes, you may wish to define the same set of local variables to all the files in a certain directory and its subdirectories, such as the directory tree of a large software project. This can be accomplished with directory-local variables.

The usual way to define directory-local variables is to put a file named .dir-locals.el in a directory. Whenever Emacs visits any file in that directory or any of its subdirectories, it will apply the directory-local variables specified in .dir-locals.el, as though they had been defined as file-local variables for that file

Please see the manual page for more information.

  • That's because I knew what to look for, but I couldn't find a variable to set. Of course, what I was missing was eval. Thanks! – mkaito Jul 14 '15 at 22:00

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.