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: Wed, 29 Dec 2004 19:14:34 -0600 (CST)

Richard Stallman wrote:

       If they think about it.  Maybe we should add something to
       `(elisp)Timers' about this, if we are sure that we definitely do not
       want timers do make undo boundaries automatically.  I could do this,
       if desired.

   I think it is to change the timer functions rather than the timer
   mechanism.  This is because not many timers will need to do it, and it
   will take some experimenting to determine just what they should do.

   I updated the manual.

The change you made to the manual says that timers (as opposed to idle
timers) should not edit user buffers.  But this is exactly what Auto
Revert mode and Auto Revert Tail mode do.  They have to use timers,
because idle timers only run once after a period of idleness and Auto
Revert has to be able to continuously update the buffer.

I suppose the remark was meant to prevent timers from interrupting
user input.  But Auto Revert takes special steps to prevent that and
so could other timers.

What about the following?  I could install if desired.

===File ~/os.texi-diff======================================
*** os.texi     29 Dec 2004 15:49:18 -0600      1.67
--- os.texi     29 Dec 2004 17:42:40 -0600      
***************
*** 1368,1377 ****
  timer to call a function that takes substantial time to run is likely
  to be annoying.
  
!   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.
  
  @deffn Command run-at-time time repeat function &rest args
  This sets up a timer that calls the function @var{function} with
--- 1368,1380 ----
  timer to call a function that takes substantial time to run is likely
  to be annoying.
  
!   When a timer edits a buffer in which undo is enabled, it normally
! should explicitly call @code{undo-boundary} once at the beginning and
! once just before exiting, since Emacs won't do that automatically
! (@pxref{Undo}).  In addition, a timer which edits a buffer that the
! user also might want to edit, should take special steps to avoid
! interrupting user input.  Using an idle timer (see below) is one way
! to avoid the latter problem.
  
  @deffn Command run-at-time time repeat function &rest args
  This sets up a timer that calls the function @var{function} with
***************
*** 1486,1496 ****
  input.  Then it becomes idle again, and all the idle timers that are
  set up to repeat will subsequently run another time, one by one.
  
-   It is legitimate for an idle timer to edit the current buffer.  If
- it does, it should explicitly call @code{undo-boundary} once at the
- beginning and once just before exiting, since Emacs won't do that
- automatically for an idle timer.
- 
  @defun cancel-timer timer
  Cancel the requested action for @var{timer}, which should be a value
  previously returned by @code{run-at-time} or @code{run-with-idle-timer}.
--- 1489,1494 ----
============================================================




reply via email to

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