* savehist-mode bug handling deeply-nested structures
@ 2008-08-11 21:30 Ami Fischman
0 siblings, 0 replies; 4+ messages in thread
From: Ami Fischman @ 2008-08-11 21:30 UTC (permalink / raw)
To: emacs-devel
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.
^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <48a85bf9.02a6420a.410f.ffffc5a7MFETCHER_ADDED@google.com>]
* Re: savehist-mode bug handling deeply-nested structures
[not found] <48a85bf9.02a6420a.410f.ffffc5a7MFETCHER_ADDED@google.com>
@ 2008-09-15 22:57 ` Ami Fischman
2008-09-20 19:49 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: Ami Fischman @ 2008-09-15 22:57 UTC (permalink / raw)
To: emacs-devel
[-- 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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* savehist-mode bug handling deeply-nested structures
@ 2008-08-11 21:29 Ami Fischman
0 siblings, 0 replies; 4+ messages in thread
From: Ami Fischman @ 2008-08-11 21:29 UTC (permalink / raw)
To: emacs-devel
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.
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-09-20 19:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2008-08-11 21:29 Ami Fischman
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.