[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [msoulier: auto-revert-mode corrupting files with cvs checkin]

From: Kim F. Storm
Subject: Re: [msoulier: auto-revert-mode corrupting files with cvs checkin]
Date: 28 Feb 2002 11:52:52 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

address@hidden (Anders Lindgren) writes:

> Hi Michael and the bugs lists!
> auto-revert-mode has very limited ways of checking if a file needs to
> be updated.  Technically the only functionality it has is the function
> `verify-visited-file-modtime'.  So, in order to fix auto-revert-mode
> this function needs to handle this kind of situations.  I can see two
> ways to accomplish this (although I have limited knowledge of the
> inner workings of the function):
> 1) Do not consider a file being updated as a candidate for reverts.
>    This will make auto-revert wait until the update has been completed
>    before it reverts the file.
> 2) Ensure that the function notices that the file has changed "again"
>    so that auto-revert can reverts it a second time.  I do not know
>    how the modification dates works (if it is the open, close, or
>    last-write, that is checked) but we must find a way to detect that
>    the the writer has finished updating the file.

3) Don't auto-revert from a file which has been modified in the last X
   seconds (X can probably be very small, 2 might be a good value).
   When auto-revert does revert the file, it must remember the
   timestamp it got on the file *before* the revert (i.e. the timestamp
   is at least X seconds before `now').  Then, if the file is being
   updated at the same time emacs auto-reverts it, emacs will
   auto-revert it again in the next auto-revert scan (or in X seconds
   whichever comes last).

The rationale of 3) is that emacs doesn't revert in the middle of an
update, and if it accidentally does that anyway, it has a way to
detect - and correct - it.

> The drawback of suggestion 1) is that it will make it impossible to
> follow a log file that is being generated.  This is a very nice
> feature that I personally would not want to miss.

My suggestion does not have this problem -- but the update will lag
X seconds behind (but I guess it is already lagging behind since
auto-revert doesn't run every second (or does it?)).

Kim F. Storm  http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]