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: Re: savehist-mode bug handling deeply-nested structures
Date: Mon, 15 Sep 2008 15:57:42 -0700	[thread overview]
Message-ID: <9aa0cfde0809151557q6f12328fr93c5fe6a7f36a336@mail.gmail.com> (raw)
In-Reply-To: <48a85bf9.02a6420a.410f.ffffc5a7MFETCHER_ADDED@google.com>

[-- Attachment #1: Type: text/plain, Size: 1868 bytes --]

Ping?

-a

On Mon, Aug 11, 2008 at 2:29 PM, Ami Fischman <ami@fischman.org> 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.
>

[-- Attachment #2: Type: text/html, Size: 3286 bytes --]

       reply	other threads:[~2008-09-15 22:57 UTC|newest]

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

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=9aa0cfde0809151557q6f12328fr93c5fe6a7f36a336@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.