Safely reload files which are changed on disc
By David Jones •
I often perform the following workflow:
- Save file I am working on
- Do 'svn update', which pulls update from server and merges in my changes
- Go back into emacs
At this point emacs tells me the file has changed on disc (true), and lets me choose between abandoning my changes, or saving the file I have edited.
I want emacs to automatically reload, but only when I have made no changes to the buffer since I last saved. Is that possible? Alternatively, just give me a way of finding out if I have made any changes since I last saved, as a sanity check.
11 Answer
Should work if you put this in your .emacs:
(global-auto-revert-mode 1)