1

I make some edits and press C-x C-s to save. Sometimes, out of blue emacs prompts this:

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

Even though I don't have the file open anywhere else, and I am sure nothing else has changed the file.

This happens rarely, only possible explanation would be that I press some combination as I bash buttons, and press save, that causes something weird. What could be the problem?

1
  • 1
    Have you tried lsof file (assuming nix system)?
    – wvxvw
    Commented Dec 27, 2014 at 16:02

1 Answer 1

3

Even though I don't have the file open anywhere else, and I am sure nothing else has changed the file.

You are probably mistaken about that.

E.g. if you sometimes create snapshot stashes with Magit then that would touch the affected files. Would you have expected that? After all it doesn't seem creating a snapshot should touch files in the working directory. Well it does because of limitations of git stash (by the way that's why the next release of Magit won't use git stash when creating stashes and instead re-implements some of its functionality in elisp).

If it's not that, then there are many other things that could touch the file behind your back.

1
  • Can we force to say yes, y in order to prevent that prompt message?
    – alper
    Commented Jul 19, 2021 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.