7

I mount an sshfs file system with

% sshfs remote.host.org:/home/jrm /home/mnt/remote.host

then edit a file under this file system with

% emacsclient -n /home/mnt/remote.host/some_file.c.

When I save the file I get the warning

some_file.c has changed since visited or saved.  Save anyway? (yes or no)

Other editors don't have this problem. What is causing this? How can I prevent it? Both hosts are running ntp and the times are the same.

TIA.

P.S. I'm aware that I can open the files directly with tramp, but I prefer sshfs assuming I can get rid of this warning every time I try to save a file.

jrm
  • 727
  • 5
  • 18
  • Is the modification time of the local file updated after you make a change, save the file, and answer 'yes' to the prompt? – Luke Girvin Feb 22 '12 at 20:53
  • Hey @LukeGirvin; No, strangely it's not. – jrm Feb 22 '12 at 21:10
  • Oh, no wait it is updated. There just seems to be a lag. – jrm Feb 22 '12 at 21:11
  • What is the value of the variable `auto-save-visited-file-name`? – Luke Girvin Feb 22 '12 at 21:38
  • Not sure if it's relevant, but I have '(auto-save-file-name-transforms (quote ((".*/\\([^/]*\\)" "~/.emacs.d/.emacs_auto_saves/\\1" t)))) in the custom set variables section of ~/.emacs so that auto-saved files are all put under ~/.emacs.d/emacs_auto_saves/ – jrm Feb 22 '12 at 22:11
  • Don't think this would be relevant, but try running Emacs with the -q flag just in case and see if that helps. – Luke Girvin Feb 22 '12 at 22:23

1 Answers1

1

I had this problem and one solution is to just ignore the warnings that the file has changed if you're sure you won't be writing over something important.

I wrote a small minor mode to ignore all file change warnings called modtime-skip-mode

you can find the repo here: https://github.com/jordonbiondo/modtime-skip-mode

this package is also on Marmalade so if you have that setup you can just

M-x: package-install <enter> modtime-skip-mode <enter>

Jordon Biondo
  • 3,974
  • 1
  • 27
  • 37