If I open a file in emacs, and the file subsequently gets moved or renamed by a different program, emacs will still save the file to the old location and name.
Example process:
- Open
ex.txt
in emacs. - Make some changes to the file.
- From another terminal, move
ex.txt
to thedir/
subdirectory. - In emacs, save the modified file.
Expected behavior: emacs realized the file was moved and saves the changes to the new file location.
Actual behavior: emacs saves the changes to the old filename and location. There are now two files, the old ex.txt
in dir/
and the modified ex.txt
in the original directory.
How can I get emacs to realize an open file has been moved and update the file in its new location?