* Invalid read syntax when using savehist.el
@ 2007-11-27 6:13 spamfilteraccount
2007-11-27 6:17 ` spamfilteraccount
0 siblings, 1 reply; 3+ messages in thread
From: spamfilteraccount @ 2007-11-27 6:13 UTC (permalink / raw)
To: bug-gnu-emacs
I have savehist turned on and yesterday startup of emacs failed with
an invalid read syntax error.
Turned out the problem was caused by a kbd macro which savehist stored
like this:
(setq command-history '( ... (execute-kbd-macro [19 107 (language-
change (#<frame ...
I assume the reader choked on the #<... part, because everything was
fine when I removed it.
GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Invalid read syntax when using savehist.el
2007-11-27 6:13 Invalid read syntax when using savehist.el spamfilteraccount
@ 2007-11-27 6:17 ` spamfilteraccount
2007-11-28 22:40 ` Reiner Steib
0 siblings, 1 reply; 3+ messages in thread
From: spamfilteraccount @ 2007-11-27 6:17 UTC (permalink / raw)
To: bug-gnu-emacs
On Nov 27, 7:13 am, "spamfilteracco...@gmail.com"
<spamfilteracco...@gmail.com> wrote:
> I have savehist turned on and yesterday startup of emacs failed with
> an invalid read syntax error.
>
> Turned out the problem was caused by a kbd macro which savehist stored
> like this:
>
> (setq command-history '( ... (execute-kbd-macro [19 107 (language-
> change (#<frame ...
>
BTW, I was switching buffers during execution of the macro and that's
why the frame is stored:
(execute-kbd-macro [19 107 (language-change (#<frame *Minibuf-1*
0x18e1c00>)) .... )
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Invalid read syntax when using savehist.el
2007-11-27 6:17 ` spamfilteraccount
@ 2007-11-28 22:40 ` Reiner Steib
0 siblings, 0 replies; 3+ messages in thread
From: Reiner Steib @ 2007-11-28 22:40 UTC (permalink / raw)
To: spamfilteraccount; +Cc: bug-gnu-emacs
On Tue, Nov 27 2007, spamfilteraccount@gmail.com wrote:
> On Nov 27, 7:13 am, "spamfilteracco...@gmail.com"
> <spamfilteracco...@gmail.com> wrote:
>> I have savehist turned on and yesterday startup of emacs failed with
>> an invalid read syntax error.
>>
>> Turned out the problem was caused by a kbd macro which savehist stored
>> like this:
>>
>> (setq command-history '( ... (execute-kbd-macro [19 107 (language-
>> change (#<frame ...
>>
>
> BTW, I was switching buffers during execution of the macro and that's
> why the frame is stored:
>
> (execute-kbd-macro [19 107 (language-change (#<frame *Minibuf-1*
> 0x18e1c00>)) .... )
The following changes have been made in `savehist.el' since the
release of Emacs 22.1. I'd guess it should fix your problem.
--8<---------------cut here---------------start------------->8---
--- savehist.el 21 Jan 2007 03:53:11 -0000 1.19
+++ savehist.el 30 Oct 2007 08:24:08 -0000 1.19.2.3
@@ -308,11 +308,42 @@
(current-buffer))
(insert ?\n)
(dolist (symbol savehist-minibuffer-history-variables)
- (when (boundp symbol)
- (let ((value (savehist-trim-history (symbol-value symbol))))
- (when value ; don't save empty histories
- (prin1 `(setq ,symbol ',value) (current-buffer))
- (insert ?\n))))))
+ (when (and (boundp symbol)
+ (not (memq symbol savehist-ignored-variables)))
+ (let ((value (savehist-trim-history (symbol-value symbol)))
+ excess-space)
+ (when value ; Don't save empty histories.
+ (insert "(setq ")
+ (prin1 symbol (current-buffer))
+ (insert " '(")
+ ;; We will print an extra space before the first element.
+ ;; Record where that is.
+ (setq excess-space (point))
+ ;; Print elements of VALUE one by one, carefully.
+ (dolist (elt value)
+ (let ((start (point)))
+ (insert " ")
+ (prin1 elt (current-buffer))
+ ;; Try to read the element we just printed.
+ (condition-case nil
+ (save-excursion
+ (goto-char start)
+ (read (current-buffer)))
+ (error
+ ;; If reading it gets an error, comment it out.
+ (goto-char start)
+ (insert "\n")
+ (while (not (eobp))
+ (insert ";;; ")
+ (forward-line 1))
+ (insert "\n")))
+ (goto-char (point-max))))
+ ;; Delete the extra space before the first element.
+ (save-excursion
+ (goto-char excess-space)
+ (if (eq (following-char) ?\s)
+ (delete-region (point) (1+ (point)))))
+ (insert "))\n"))))))
;; Save the additional variables.
(dolist (symbol savehist-additional-variables)
(when (boundp symbol)
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-11-28 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-27 6:13 Invalid read syntax when using savehist.el spamfilteraccount
2007-11-27 6:17 ` spamfilteraccount
2007-11-28 22:40 ` Reiner Steib
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.