From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Davison Newsgroups: gmane.emacs.help Subject: flet not undone on lisp nesting error Date: Sat, 27 Feb 2010 15:22:02 -0500 Message-ID: <87mxyuv385.fsf@stats.ox.ac.uk> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267396323 26892 80.91.229.12 (28 Feb 2010 22:32:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 28 Feb 2010 22:32:03 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 28 23:32:00 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nlrg7-0001yI-1T for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Feb 2010 23:31:59 +0100 Original-Received: from localhost ([127.0.0.1]:56602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nlrg6-0002E6-FR for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Feb 2010 17:31:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NlTAz-0006ET-M6 for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 15:22:13 -0500 Original-Received: from [140.186.70.92] (port=39142 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NlTAy-0006EK-SP for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 15:22:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NlTAu-0002YO-9b for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 15:22:12 -0500 Original-Received: from markov.stats.ox.ac.uk ([163.1.210.1]:63188) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NlTAt-0002YF-TR for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 15:22:08 -0500 Original-Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id o1RKM5SJ024331 for ; Sat, 27 Feb 2010 20:22:05 GMT Original-Received: by blackcap.stats.ox.ac.uk (Postfix, from userid 5158) id 798223201D; Sat, 27 Feb 2010 20:22:05 +0000 (GMT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 8 (1) X-Mailman-Approved-At: Sun, 28 Feb 2010 17:30:25 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72244 Archived-At: If I trigger a lisp nesting error with an infinite recursion inside a let and an flet binding, then the effects of the flet are not undone, resulting in a change of binding at the top-level. (Code below; the effects of the let are undone). However, if I trigger a "normal" error with (error) then both are undone. Is this peculiar to a circular lisp nesting error, or are there other classes of error upon which flet will not be undone? What is the idiomatic way to protect against this (other than not having infinite recursions in my code)? Do I have to keep copies of the original values for use in an unwind-protect? Dan --8<---------------cut here---------------start------------->8--- (defun g () 'g-orig) (setq a 'a-orig) (defun h () (let ((a 'a-new)) (flet ((g () 'g-new)) (h)))) (h) ;; <-- Lisp nesting exceeds `max-lisp-eval-depth' (g) ;; 'g-new ! a ;; a-orig (defun g () 'g-orig) (setq a 'a-orig) (defun f () (let ((a 'a-new)) (flet ((g () 'g-new)) (error "Error!")))) (f) (g) ;; <-- 'g-orig a ;; <-- 'a-orig --8<---------------cut here---------------end--------------->8---