From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.devel Subject: Re: unwind-protect not cleaning up? Date: Sat, 30 Jun 2012 11:01:21 +0530 Message-ID: <81bok15psm.fsf@gmail.com> References: <814nptaab9.fsf@gmail.com> <87vci97dso.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1341034319 21818 80.91.229.3 (30 Jun 2012 05:31:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Jun 2012 05:31:59 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?utf-8?Q?=C3=93scar?= Fuentes Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 30 07:31:58 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 1SkqHk-00027c-Eg for ged-emacs-devel@m.gmane.org; Sat, 30 Jun 2012 07:31:56 +0200 Original-Received: from localhost ([::1]:55469 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkqHk-0007we-0l for ged-emacs-devel@m.gmane.org; Sat, 30 Jun 2012 01:31:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55097) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkqHh-0007wZ-CK for emacs-devel@gnu.org; Sat, 30 Jun 2012 01:31:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SkqHf-0002OR-Eq for emacs-devel@gnu.org; Sat, 30 Jun 2012 01:31:52 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:50577) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SkqHf-0002OI-6T for emacs-devel@gnu.org; Sat, 30 Jun 2012 01:31:51 -0400 Original-Received: by pbbrp2 with SMTP id rp2so5966244pbb.0 for ; Fri, 29 Jun 2012 22:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=cN9Yvs5Gz8audEp93/Nk02Zc0NXAJwZz9kFtbZ97YtU=; b=FrkuF4GatQAaKq1KM2hp3R940zMNoIPNinrZK7RH3zYQwcjVhVeBsoMFez/RHBB787 qZZSss3d7HprUx+VkCvIJUm3Grj84FGo0mSHU0ZHQd8sR3s0rfe4eSzz+tqSBLzrwVHN 3kWmmKKxZfgWk9Gl40LuK+3HAht8VetviKan+OFiQb0QJF3eTlpINCQdVbMhOctbLmal E6sWN7cZ0kIQKu3LNvm64RPyU2iBcf+7A1MCAYXMXDdIszDRY7Uh38b0LweOdp9E6NKq KQMGzG/FW0gXEI/LTKNr8t9Ve/PuzCgnYCk17jruDs8A0go3lEB4FCkrPBEeHQPR0hYo F9cA== Original-Received: by 10.68.233.225 with SMTP id tz1mr12751751pbc.4.1341034308997; Fri, 29 Jun 2012 22:31:48 -0700 (PDT) Original-Received: from JAMBU-NETBOOK ([101.63.116.0]) by mx.google.com with ESMTPS id vz9sm7432279pbc.12.2012.06.29.22.31.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 29 Jun 2012 22:31:48 -0700 (PDT) In-Reply-To: <87vci97dso.fsf@wanadoo.es> (=?utf-8?Q?=22=C3=93scar?= Fuentes"'s message of "Sat, 30 Jun 2012 04:07:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (windows-nt) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.41 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:151314 Archived-At: =C3=93scar Fuentes writes: > Jambunathan K writes: > >> The snippet below is taken from (info "(elisp) Cleanups") with minor >> modifications. Put it in a scratch buffer and C-x C-e it. Once it is >> done, I am able to C-x b to YOU CANNOT KILL ME. >> >> (let ((buffer (get-buffer-create "YOU CANNOT KILL ME"))) >> (with-current-buffer buffer >> (unwind-protect >> (/ 1 0) >> (kill-buffer buffer)))) >> >> Comments... > > Here the debugger pops up with > > Debugger entered--Lisp error: (arith-error) > /(1 0) > (unwind-protect (/ 1 0) (kill-buffer buffer)) > [...] > > and then if I press `c' (for continuing) it goes away and there is no > trace left of the buffer previously created. > > This looks correct to me. Do you see the debugger? Does the same thing > with emacs -Q ? > > GNU Emacs 24.0.94.2 (x86_64-unknown-linux-gnu, X toolkit) of > 2012-03-11 Oh, Ok. I get the same behaviour as you do. Nothing in the manual suggests that some sort of user-intervention is required for recovery. Is unwind-protect meant only for use be developers? As someone who was considering using this for the first time, I am confused by this "user-intervention" behaviour. 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... Btw, if unwind-protect is behaving the right way, manpage needs an update... --=20