emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Big desktop undo buffer crashes Emacs


From: Luc Teirlinck
Subject: Re: Big desktop undo buffer crashes Emacs
Date: Thu, 11 May 2006 21:11:16 -0500 (CDT)

Bill Wohler wrote:

   OK, it's back. Here's the message:

      Buffer `*desktop*' undo info is 3159101 bytes long; discard it? (yes or 
no)

The patch below should solve your problem, or part of your problem.
There is no reason for the `*desktop*' buffer to accumulate a huge
undo entry just to allow you to erase the buffer completely using `M-x
undo'.  So the patch below disables undo while desktop.el writes all
these entries in the *desktop* buffer.  After that, undo is re-enabled
however.  So if you then inadvertently mess up the buffer, repeated
undo will restore the buffer to what desktop.el wrote in it.  But one
more undo will not erase the buffer.  Instead, it will tell you that
there is no further undo info.

I said that it might solve "part" of your problem.  The question is
whether the 3M of undo is legitimate.  Take a look at what is in that
buffer.  Does the huge size of the buffer seem legitimate, because
there really is that much info to save?  I guess that you know that
you can produce the buffer using `M-x desktop-save'.

I believe that my patch should be applied regardless of whether the 3M
is legitimate, but if it is not, additional changes may be necessary.

===File ~/desktop.el-diff===================================
*** desktop.el  10 Feb 2006 08:34:46 -0600      1.99
--- desktop.el  11 May 2006 20:42:50 -0500      
***************
*** 766,804 ****
            (eager desktop-restore-eager)
            (buf (get-buffer-create "*desktop*")))
        (set-buffer buf)
!       (erase-buffer)
  
!       (insert
!         ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n"
!         desktop-header
!         ";; Created " (current-time-string) "\n"
!         ";; Desktop file format version " desktop-file-version "\n"
!         ";; Emacs version " emacs-version "\n\n"
!         ";; Global section:\n")
!       (mapc (function desktop-outvar) desktop-globals-to-save)
!       (if (memq 'kill-ring desktop-globals-to-save)
!         (insert
!           "(setq kill-ring-yank-pointer (nthcdr "
!           (int-to-string (- (length kill-ring) (length 
kill-ring-yank-pointer)))
!           " kill-ring))\n"))
  
!       (insert "\n;; Buffer section -- buffers listed in same order as in 
buffer list:\n")
!       (mapc #'(lambda (l)
!                 (when (apply 'desktop-save-buffer-p l)
!                   (insert "("
!                           (if (or (not (integerp eager))
!                                   (unless (zerop eager)
!                                     (setq eager (1- eager))
!                                     t))
!                               "desktop-create-buffer"
!                             "desktop-append-buffer-args")
!                           " "
!                           desktop-file-version)
!                   (mapc #'(lambda (e)
!                             (insert "\n  " (desktop-value-to-string e)))
!                         l)
!                   (insert ")\n\n")))
!             info)
        (setq default-directory dirname)
        (let ((coding-system-for-write 'emacs-mule))
          (write-region (point-min) (point-max) filename nil 'nomessage))))
--- 766,807 ----
            (eager desktop-restore-eager)
            (buf (get-buffer-create "*desktop*")))
        (set-buffer buf)
!       (when (consp buffer-undo-list)
!       (setq buffer-undo-list nil))
!       (let ((buffer-undo-list t))
!       (erase-buffer)
  
!       (insert
!        ";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n"
!        desktop-header
!        ";; Created " (current-time-string) "\n"
!        ";; Desktop file format version " desktop-file-version "\n"
!        ";; Emacs version " emacs-version "\n\n"
!        ";; Global section:\n")
!       (mapc (function desktop-outvar) desktop-globals-to-save)
!       (if (memq 'kill-ring desktop-globals-to-save)
!           (insert
!            "(setq kill-ring-yank-pointer (nthcdr "
!            (int-to-string (- (length kill-ring) (length 
kill-ring-yank-pointer)))
!            " kill-ring))\n"))
  
!       (insert "\n;; Buffer section -- buffers listed in same order as in 
buffer list:\n")
!       (mapc #'(lambda (l)
!                 (when (apply 'desktop-save-buffer-p l)
!                   (insert "("
!                           (if (or (not (integerp eager))
!                                   (unless (zerop eager)
!                                     (setq eager (1- eager))
!                                     t))
!                               "desktop-create-buffer"
!                             "desktop-append-buffer-args")
!                           " "
!                           desktop-file-version)
!                   (mapc #'(lambda (e)
!                             (insert "\n  " (desktop-value-to-string e)))
!                         l)
!                   (insert ")\n\n")))
!             info))
        (setq default-directory dirname)
        (let ((coding-system-for-write 'emacs-mule))
          (write-region (point-min) (point-max) filename nil 'nomessage))))
============================================================




reply via email to

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