How can I configure Emacs to update a buffer's file association when the file is renamed externally?
In Textmate, I can open a file "foo.txt", use a different program to rename the file to "bar.txt", and Textmate automatically notices that the file was renamed. The new filename is displayed in the Textmate's window title, and editing and saving the file writes the changes to "bar.txt".
In Emacs, if I open a file "foo.txt" then use a different program to rename the file to "bar.txt", Emacs' buffer is still associated with "foo.txt". Editing and saving the file writes the file back to "foo.txt", but I would like it to write the file to "bar.txt" (I would also like the buffer name to change to "bar.txt", and for revert-buffer
to read the file from "bar.txt").
auto-revert-mode
.