From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.bugs Subject: Re: Invalid read syntax when using savehist.el Date: Wed, 28 Nov 2007 23:40:59 +0100 Message-ID: References: Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1196289715 14845 80.91.229.12 (28 Nov 2007 22:41:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 Nov 2007 22:41:55 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 28 23:42:00 2007 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IxVbK-00043X-0F for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Nov 2007 23:41:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IxVb4-0000xo-IL for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Nov 2007 17:41:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IxVaz-0000x2-KP for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2007 17:41:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IxVay-0000we-4S for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2007 17:41:29 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IxVay-0000wb-0h for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2007 17:41:28 -0500 Original-Received: from mail.uni-ulm.de ([134.60.1.11]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IxVax-0005YT-4B for bug-gnu-emacs@gnu.org; Wed, 28 Nov 2007 17:41:27 -0500 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.41.37]) by mail.uni-ulm.de (8.14.1/8.14.1) with ESMTP id lASMfN8o026283; Wed, 28 Nov 2007 23:41:23 +0100 (MET) Original-Received: from localhost (bridgekeeper.physik.uni-ulm.de [134.60.41.37]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id 5445112DB5; Wed, 28 Nov 2007 23:41:23 +0100 (CET) X-Face: 1; h7XMU[7l}$T@J.D}5z*w8Tg'}B5ArAWc8>2X~otB; kOjKs8X%|hTC#dG:%Vpx")x7S/`v :VXU#fZW$X$zdhEU.RfVQ@<-m9IuN{Hm"fW{,5]6kR'M*vEs+{5Cj!L(JTRzA$(},?5J=sm; %Od, bug-gnu-emacs@gnu.org In-Reply-To: (spamfilteraccount@gmail.com's message of "Mon, 26 Nov 2007 22:17:31 -0800 (PST)") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) X-DCC-dcc.uncw.edu-Metrics: poseidon 1201; Body=2 Fuz1=2 Fuz2=2 X-Virus-Scanned: by amavisd-new X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:17083 Archived-At: On Tue, Nov 27 2007, spamfilteraccount@gmail.com wrote: > On Nov 27, 7:13 am, "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 (#> > > 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 (# 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/