From: Andreas Schwab <schwab@suse.de>
To: alinsoar@voila.fr
Cc: "Emacs Help \[help-gnu-emacs\]" <help-gnu-emacs@gnu.org>,
"Lennart Borgman \(gmail\)" <lennart.borgman@gmail.com>,
"Emacs Bug \[bug-gnu-emacs\]" <bug-gnu-emacs@gnu.org>
Subject: Re: (progn (top-level) A B C)
Date: Wed, 14 Feb 2007 18:48:38 +0100 [thread overview]
Message-ID: <jefy98tytl.fsf@sykes.suse.de> (raw)
In-Reply-To: <3473217.139831171474628637.JavaMail.www@wwinf4102> (A. Soare's message of "Wed, 14 Feb 2007 18:37:08 +0100 (CET)")
A Soare <alinsoar@voila.fr> writes:
> Thanks, I will check. Another method that I found is
>
> (unwind-protect
> (prog1
> (message "x")
> (top-level))
> (message "a")
> (message "b"))
>
>
> By the way, this code returns "Back to top level." . BAD.
It does not return anything.
> x
> a
> b
> Back to top level.
>
> What is the definition of prog1? It should return the first argument. It seems that in this case the 1st argument is lost.
This is not a bug. (top-level) throws to 'top-level, thus (prog1 ...) is
never finished. unwind-protect only returns a value if the body completes
normally. Otherwise it does not return anything, rather execution is
transferred directly to the receiving exception handler after executing
the unwind forms.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2007-02-14 17:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-14 17:37 (progn (top-level) A B C) A Soare
2007-02-14 17:48 ` Andreas Schwab [this message]
[not found] <mailman.4495.1171467492.2155.help-gnu-emacs@gnu.org>
2007-02-14 16:22 ` Pascal Bourguignon
-- strict thread matches above, loose matches on Subject: below --
2007-02-14 15:38 A Soare
2007-02-14 16:38 ` Lennart Borgman (gmail)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jefy98tytl.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=alinsoar@voila.fr \
--cc=bug-gnu-emacs@gnu.org \
--cc=help-gnu-emacs@gnu.org \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).