emacs-devel
[Top][All Lists]
Advanced

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

Re: undo in loaddefs.el buffer


From: Luc Teirlinck
Subject: Re: undo in loaddefs.el buffer
Date: Fri, 31 Dec 2004 09:04:26 -0600 (CST)

David Kastrup wrote:

   > But 100% of the known examples (Auto Revert and Auto Revert Tail)
   > contradict the rules.

   If the rule is "you should not ...", of course 100% of all relevant
   examples are exceptions.

The stated rules are:

    Timer functions should normally not alter the current buffer contents,
    but it may be ok to alter some other buffer that exists for special
    purposes.  A general guideline is that if a buffer has undo enabled,
    timers should not write in it.

The three guidelines given are that the buffer written into should not
be current (but that guideline seems so strange that it is probably
just a misformulation), that the buffer should only exist for special
purposes and, most importantly, that it should not have undo enabled.
All known examples write into buffers that are current when they alter
it and, more importantly, into buffers that have (by default) undo
enabled.  Most buffers they alter are normal file visiting buffers
that do not exist for special purposes.  Dired and the Buffer Menu
exist for special purposes, but their main purpose is not to be
autoreverted.

But the one important thing is that they operate on buffers that have
undo enabled.  The rest is side stuff.

   And they have to take special measures to deal with the consequences
   of violating the rule.

Some of which are obvious and some of which are non-obvious.  My
proposal is to point out the latter.  There is no need to point out
that you should not blindly overwrite user editing, it is obvious.
There is a need to point out that Emacs will not automatically put in
undo boundaries and that, consequently, one might accumulate one big
undo entry, unless one does something about it.  The correct solution
is not always to disable undo.  It was not the solution we decided on
in any of cases we looked at.  All these cases involved timers, not
idle timers.

Sincerely,

Luc.




reply via email to

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