tags:

views:

182

answers:

2

How to disable Emacs from checking the buffer file was changed outside the editor?

+4  A: 

Emacs is really trying to help you here. Read the info page on Protection against Simultaneous Editing.

But, if you still want to avoid that message/prompt, you can redefine the function that is doing the prompting:

(defun ask-user-about-supersession-threat (fn)
  "blatantly ignore files that changed on disk"
  )
(defun ask-user-about-lock (file opponent)
  "always grab lock"
   t)

The second function there is for when two people are using Emacs to edit the same file, and would provide a similar prompt (but not the one you seemed to refer to in the question).

I'd advise against overriding the two routines, but it's there if you want.


On the off chance global-auto-revert-mode is on, you could disable that. Add this to your .emacs:

(global-auto-revert-mode -1)

You can tell if the mode is on by looking at the variable of the same name:

C-h v global-auto-revert-mode RET

If the value is t, then the mode is on, otherwise it is off.

Trey Jackson
+1  A: 

I had annoyance with this because every time I switched branches in git, emacs thought all my files had changed.

Revbuffs helps you cope with the symptoms of this. It allows you to cause all your buffers to be reloaded.

You can also try (global-auto-revert-mode) which will automatically revert your files to what's on disk.

Singletoned