[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lisp unwind-protect question
From: |
Stefan Monnier |
Subject: |
Re: lisp unwind-protect question |
Date: |
05 Mar 2002 18:44:58 -0500 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50 |
>> (unwind-protect
>> (foo)
>> (bar)
>> (baz))
>>
>> What's supposed to happen if (bar) signals an error? Does (baz) still
>> get run?
> Sure.
I don't think so:
ELISP> (unwind-protect 1 (error "hey") (setq tmp 'toto))
*** Eval error *** error: "hey"
ELISP> tmp
*** Eval error *** Symbol's value as variable is void: tmp
ELISP>
>> What if bar doesn't signal an error by itself, but some asynchronous
>> signal arrives (e.g. user hits C-g) while bar is running?
C-g is inhibited while evaluating the UNWINDFORMS, so the async signal
is postponed to after the UNWINDFORMS have been executed. Better not
put an infinite loop in there ;-(
Stefan