unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* global-auto-revert-mode and file time stamps
@ 2013-05-21 13:36 Timur Aydin
  2013-05-21 17:26 ` Peter Dyballa
  0 siblings, 1 reply; 4+ messages in thread
From: Timur Aydin @ 2013-05-21 13:36 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: global-auto-revert-mode and file time stamps
  2013-05-21 13:36 global-auto-revert-mode and file time stamps Timur Aydin
@ 2013-05-21 17:26 ` Peter Dyballa
  2013-05-21 17:54   ` Timur Aydin
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Dyballa @ 2013-05-21 17:26 UTC (permalink / raw)
  To: Timur Aydin; +Cc: help-gnu-emacs


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.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: global-auto-revert-mode and file time stamps
  2013-05-21 17:26 ` Peter Dyballa
@ 2013-05-21 17:54   ` Timur Aydin
  2013-05-23 21:35     ` Ken Goldman
  0 siblings, 1 reply; 4+ messages in thread
From: Timur Aydin @ 2013-05-21 17:54 UTC (permalink / raw)
  To: Peter Dyballa; +Cc: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: global-auto-revert-mode and file time stamps
  2013-05-21 17:54   ` Timur Aydin
@ 2013-05-23 21:35     ` Ken Goldman
  0 siblings, 0 replies; 4+ messages in thread
From: Ken Goldman @ 2013-05-23 21:35 UTC (permalink / raw)
  To: help-gnu-emacs

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)







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-23 21:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-21 13:36 global-auto-revert-mode and file time stamps Timur Aydin
2013-05-21 17:26 ` Peter Dyballa
2013-05-21 17:54   ` Timur Aydin
2013-05-23 21:35     ` Ken Goldman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).