From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ami Fischman" Newsgroups: gmane.emacs.devel Subject: savehist-mode bug handling deeply-nested structures Date: Mon, 11 Aug 2008 14:29:22 -0700 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1218490192 15538 80.91.229.12 (11 Aug 2008 21:29:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Aug 2008 21:29:52 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 11 23:30:43 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KSeyD-0008GD-Dc for ged-emacs-devel@m.gmane.org; Mon, 11 Aug 2008 23:30:29 +0200 Original-Received: from localhost ([127.0.0.1]:33502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSexG-0007p5-Vy for ged-emacs-devel@m.gmane.org; Mon, 11 Aug 2008 17:29:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KSexB-0007kg-PX for emacs-devel@gnu.org; Mon, 11 Aug 2008 17:29:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KSexA-0007gt-0r for emacs-devel@gnu.org; Mon, 11 Aug 2008 17:29:25 -0400 Original-Received: from [199.232.76.173] (port=53111 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSex9-0007gb-Sd for emacs-devel@gnu.org; Mon, 11 Aug 2008 17:29:23 -0400 Original-Received: from wr-out-0506.google.com ([64.233.184.226]:28765) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KSex9-0001Pr-IC for emacs-devel@gnu.org; Mon, 11 Aug 2008 17:29:23 -0400 Original-Received: by wr-out-0506.google.com with SMTP id c30so1777914wra.14 for ; Mon, 11 Aug 2008 14:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=jfQMFyFeIfHHW3fG3/tcHq8YFQ321u300ZleQbM6BbI=; b=aeFrvMnAqNAPrJL4dyg7nSUIJA5/AoH7GvA7zAk5LhDCcM0fVw1wOxWub+vJxzQ+6G PSN4xivwAAmF8b99ARBSX9L8kTatVJFvCzJMsj3/ijGRKgiaKjFP8EeVsZakMw8Cl6yO USxEaKydL9m0s7tCJlPjus8U7kLRkNerme7T4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=qxR7cvkmdBY15Yj92hKt1bO9ZOxTUJ4WmBmdniwYHGoL6ZZctxydX46W2mgQxxj/IE Y3lonEb3uDPSvspxoll0vFrD3DJN5bj2sM/MFv8tY/BIZP2Idv6ZKgX7H68v44vu7QDx tXR7Yo8jXLuPke8eXqkN5AhHw3qKF8v2bF/qY= Original-Received: by 10.90.83.18 with SMTP id g18mr11308050agb.76.1218490162546; Mon, 11 Aug 2008 14:29:22 -0700 (PDT) Original-Received: by 10.90.101.14 with HTTP; Mon, 11 Aug 2008 14:29:22 -0700 (PDT) Content-Disposition: inline X-Google-Sender-Auth: b1f002331a635cab X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102300 Archived-At: 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.