emacs-devel
[Top][All Lists]
Advanced

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

Re: savehist-mode bug handling deeply-nested structures


From: Ami Fischman
Subject: Re: savehist-mode bug handling deeply-nested structures
Date: Mon, 15 Sep 2008 15:57:42 -0700

Ping?

-a

On Mon, Aug 11, 2008 at 2:29 PM, Ami Fischman <address@hidden> wrote:
savehist-save uses prin1 to save history-related variables between
emacs invocations.  It is common to add savehist-autosave to
kill-emacs-hook.  Unfortunately if one of the variables being
autosaved is deeply-enough nested that prin1 gives up on it
(print.c:PRINT_CIRCLE == 200) then savehist-save errors out, making it
impossible to exit emacs cleanly until either the variable is
simplified (hard to do because the prin1 error doesn't mention the
variable name) or savehist-autosave is removed from the hook.

I think the fix is as simple as:

diff --git a/lisp/savehist.el b/lisp/savehist.el
index c2674fd..0cbb5f9 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -318,12 +318,13 @@ If AUTO-SAVE is non-nil, compare the saved
contents to the one last saved,
               (dolist (elt value)
                 (let ((start (point)))
                   (insert " ")
-                   (prin1 elt (current-buffer))
-                   ;; Try to read the element we just printed.
+                   ;; Print and try to read the element we just printed.
                   (condition-case nil
-                       (save-excursion
-                         (goto-char start)
-                         (read (current-buffer)))
+                        (progn
+                          (prin1 elt (current-buffer))
+                          (save-excursion
+                            (goto-char start)
+                            (read (current-buffer))))
                     (error
                      ;; If reading it gets an error, comment it out.
                      (goto-char start)

-a

P.S.  I wonder how many of the other users of prin1 in lisp/ contain
similar unrobustnesses.


reply via email to

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