[Top][All Lists]

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

Re: Big desktop undo buffer crashes Emacs

From: Bill Wohler
Subject: Re: Big desktop undo buffer crashes Emacs
Date: Thu, 11 May 2006 21:54:59 -0700

Luc Teirlinck <address@hidden> wrote:

> Bill Wohler wrote:
>    By the way, the only two desktop-related items in my .emacs are turning
>    on desktop-save-mode (which is probably obvious ;-) and this:
>      (run-at-time 60 300 'desktop-save "~") ;it would be better to catch HUP 
> and
>                                           ;call desktop-save before exiting
> The latter was your problem.   From `(elisp)Timers':
>      It is usually a bad idea for timer functions to alter buffer
>   contents.  When they do, they usually should call `undo-boundary' both
>   before and after changing the buffer, to separate the timer's changes
>   from user commands' changes and prevent a single undo entry from
>   growing to be quite large.
> So it is no surprise that you accumulated such a large single undo entry.

Thanks for the information. Since I don't understand the mechanics of
desktop, I have a couple of questions about that. First, I thought
desktop-save just saves the buffer to a file. Is it really altering the
the *desktop* buffer? Oh, running desktop-save a couple of times shows
that it at least updates the Created header field. OK, desktop-save must
gather buffer information, write it to *desktop*, and *then* save it to
a file. Right?

Second, I also don't understand the mechanics of undo very well. I was
under the impression that undo-boundary only grouped a set of changes
into a single undo entry. As I sit here writing, only a limited amount
of changes are saved and at some point the oldest undo information will
be discarded. How is the timer different?

Interesting, as I typed this, the timer had run a couple of times (I was
thinking and trying to understand desktop and undo). I re-ran `C-h v
buffer-undo-list' a few times too. It just produced buffers with only 35
kB, not 68 kB.

>    Right now my desktop buffer is 32 kB;
> So that is approximately 32 kB every five minutes.  After eight hours,
> you exceed 3M.
> Anyway, my patch, or disabling undo, completely gets rid of this problem.

So, which one should I apply? Before I fix my timer ;-).

If the *desktop* buffer is ephemeral and recreated when desktop-save is
run, it seems that disabling undo is the proper course of action.
Otherwise, preserving undo while protecting against abuse would be wise.
What do you think?

Bill Wohler <address@hidden>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

reply via email to

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