[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unwind-protect not cleaning up?

From: Jambunathan K
Subject: Re: unwind-protect not cleaning up?
Date: Sat, 30 Jun 2012 11:01:21 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (windows-nt)

Óscar Fuentes <address@hidden> writes:

> Jambunathan K <address@hidden> 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 (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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]