0

Version Details: Emacs 28.2 On Debian 12

Steps to reproduce: I am editing Groovy files in a Git workspace. When I load the files they come up as fundamental so I switch to java-mode. All works as expected, if the file is saved in emacs and then edited by another program, say in vim as an example, or even has another groovy file copied over it, emacs auto reverts as expected and maintains the editing mode.

However if I revert all changes to that file by doing a git checkout then emacs shows the dreaded red M and I have to manually revert the buffer.

If I repeat the above but DON'T change the buffer mode from fundamental then emacs picks up the changes and auto reverts on the git checkout as well.

It's as if it treats a change in buffer mode as a change too far under certain circumstances.

This is really annoying when git rebasing, when cleaning up history etc. This used not to happen on older versions of emacs (v25.2.1).

Can anyone help? Is there a magic setting somewhere to bring back the old behaviour?

1 Answer 1

1

It does seem that switching file modes upsets auto-revert (fundamental -> Java). I installed the groovy-mode package from MELPA so that when a Groovy file is loaded into Emacs it's buffer is automatically set up with the right editing mode and no switch is needed by the user. auto-revert mode then works as expected when doing git rebase or git checkout that results in changing a file's contents.

1
  • This doesn't provide a clear answer to the question. Please provide some details. Commented Mar 13, 2024 at 15:51

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.