emacs-devel
[Top][All Lists]
Advanced

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

savehist-mode bug handling deeply-nested structures


From: Ami Fischman
Subject: savehist-mode bug handling deeply-nested structures
Date: Mon, 11 Aug 2008 14:30:51 -0700

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]