From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: unwind-protect not cleaning up? Date: Sat, 30 Jun 2012 09:09:06 +0300 Message-ID: <83bok172m5.fsf@gnu.org> References: <814nptaab9.fsf@gmail.com> <87vci97dso.fsf@wanadoo.es> <81bok15psm.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1341036582 1273 80.91.229.3 (30 Jun 2012 06:09:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Jun 2012 06:09:42 +0000 (UTC) Cc: ofv@wanadoo.es, emacs-devel@gnu.org To: Jambunathan K Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 30 08:09:42 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SkqsH-000837-PO for ged-emacs-devel@m.gmane.org; Sat, 30 Jun 2012 08:09:41 +0200 Original-Received: from localhost ([::1]:34384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkqsH-0004jz-Io for ged-emacs-devel@m.gmane.org; Sat, 30 Jun 2012 02:09:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkqsE-0004ji-Iu for emacs-devel@gnu.org; Sat, 30 Jun 2012 02:09:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SkqsC-0003IB-Qz for emacs-devel@gnu.org; Sat, 30 Jun 2012 02:09:38 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:51692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkqsC-0003I5-Iw for emacs-devel@gnu.org; Sat, 30 Jun 2012 02:09:36 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M6F00F00299O100@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sat, 30 Jun 2012 09:09:18 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M6F00FD92FHMJ20@a-mtaout22.012.net.il>; Sat, 30 Jun 2012 09:09:18 +0300 (IDT) In-reply-to: <81bok15psm.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151316 Archived-At: > From: Jambunathan K > Date: Sat, 30 Jun 2012 11:01:21 +0530 > Cc: emacs-devel@gnu.org > > Nothing in the manual suggests that some sort of user-intervention > is required for recovery. Because no intervention is needed, in general. It's just that you tried to trigger the stack unwinding with something that signals an error and enters the debugger. Change your example to this: (let ((buffer (get-buffer-create "YOU CANNOT KILL ME"))) (with-current-buffer buffer (let ((eval-expression-debug-on-error nil) (debug-on-signal nil)) (unwind-protect (/ 1 0) (kill-buffer buffer))))) and you will get what you expected without any user intervention. > May be I should be looking at someother API that "guarantees" cleanup > very much like unwind-protect, without the 'c' part. > > I can use (condition-case VAR BODYFORM &rest HANDLERS) with the cleanup > happening both in BODYFORM and also in (error ) HANDLER. I felt that > unwind-protect construct is more elegant. Any suggestions... The popular use for unwind-protect is when the user could C-g inside the protected form. For errors such as division by zero, condition-case is indeed better, as you can run some code when the error is thrown. > Btw, if unwind-protect is behaving the right way, manpage needs an > update... We don't have manpages in Emacs. Did you mean the manual? If so, what would you suggest to add/update there, in view of the above?