Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

global-auto-revert-mode and file time stamps

2 views
Skip to first unread message

Timur Aydin

unread,
May 21, 2013, 9:36:32 AM5/21/13
to help-gn...@gnu.org
When a file's timestamp has been changed, but the contents are still the
same, what should be the behavior of emacs be? With the emacs that I am
using (development version):

GNU Emacs 24.3.50.1 (i686-pc-linux-gnu, GTK+ Version 3.6.3)
of 2013-05-01 on bonsai

It thinks the file is changed. Here is what I do:

- Open a file, edit it and then save.

- use the "touch" command to update the time stamp of this file.

- Wait way more than the auto revert interval (which is set to 5 seconds
in my case).

- Try to make a change to the buffer corresponding to this file.

At this point, emacs says that the file has changed and asks whether I
really want to edit it. I was expecting emacs to auto revert this buffer
and allow me to edit it without further questions. So my question is, am
I looking at a bug, or a feature?

--
Timur Aydin

Peter Dyballa

unread,
May 21, 2013, 1:26:33 PM5/21/13
to Timur Aydin, help-gn...@gnu.org

Am 21.05.2013 um 15:36 schrieb Timur Aydin:

> At this point, emacs says that the file has changed and asks whether I
> really want to edit it. I was expecting emacs to auto revert this buffer
> and allow me to edit it without further questions. So my question is, am
> I looking at a bug, or a feature?

GNU Emacs will never automatically return to a previous state of the file. That's left up to you. What it does is, that it warns you, that it gives you information to make better decisions.

This is OK with me.

--
Greetings

Pete

Don't just do something, sit there.


Timur Aydin

unread,
May 21, 2013, 1:54:46 PM5/21/13
to Peter Dyballa, help-gn...@gnu.org
On 5/21/2013 8:26 PM, Peter Dyballa wrote:
> GNU Emacs will never automatically return to a previous state of the file. That's left up to you. What it does is, that it warns you, that it gives you information to make better decisions.

I don't want emacs to return the file to its previous state.
global-auto-revert-mode doesn't do that, anyway. global-auto-revert-mode
detects that a file has been changed on disc, and if I haven't made any
edits to that file, it reverts the file _AUTOMATICALL_, without asking
any questions. So that works as expected.

What doesn't work is, if only the timestamp of the file changes (touch
filename), then emacs doesn't autorevert it, and instead tells me that
it changed and asks whether I want to really edit it.

Hope this makes it clear...

--
Timur Aydin

Ken Goldman

unread,
May 23, 2013, 5:35:48 PM5/23/13
to help-gn...@gnu.org
On 5/21/2013 1:54 PM, Timur Aydin wrote:
>
> What doesn't work is, if only the timestamp of the file changes (touch
> filename), then emacs doesn't autorevert it, and instead tells me that
> it changed and asks whether I want to really edit it.

when I 'touch' on Windows or Linux, it does what you expect, not what
you're observing. It autoreverts the file.

I have this in .emacs:

(autoload 'auto-revert-mode "autorevert" nil t)
(autoload 'turn-on-auto-revert-mode "autorevert" nil nil)
(autoload 'global-auto-revert-mode "autorevert" nil t)
(global-auto-revert-mode 1)
(setq auto-revert-interval 2)
(global-set-key "\C-cr" 'revert-buffer)





0 new messages