all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ami Fischman" <ami@fischman.org>
To: emacs-devel@gnu.org
Subject: savehist-mode bug handling deeply-nested structures
Date: Mon, 11 Aug 2008 14:29:22 -0700	[thread overview]
Message-ID: <b5a678470808111429i6543db51g91cc9fe38e25183d@mail.gmail.com> (raw)

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	other threads:[~2008-08-11 21:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-11 21:29 Ami Fischman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-08-11 21:30 savehist-mode bug handling deeply-nested structures Ami Fischman
     [not found] <48a85bf9.02a6420a.410f.ffffc5a7MFETCHER_ADDED@google.com>
2008-09-15 22:57 ` Ami Fischman
2008-09-20 19:49   ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5a678470808111429i6543db51g91cc9fe38e25183d@mail.gmail.com \
    --to=ami@fischman.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.