From: Alan Mackenzie <acm@muc.de>
To: Chris Gregory <czipperz@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Define progn_ignore to run Fprogn and ignore output
Date: Tue, 27 Dec 2016 15:49:47 +0000 [thread overview]
Message-ID: <20161227154947.GA2324@acm.fritz.box> (raw)
In-Reply-To: <871swum82w.fsf@CzipperZag.i-did-not-set--mail-host-address--so-tickle-me>
Hello, Chris.
Just a small point about your proposed patch.
On Mon, Dec 26, 2016 at 08:14:47PM -0600, Chris Gregory wrote:
> This patch defines progn_ignore to do Fprogn but not return a result.
> This will minorly speed up all operations using `unwind_body'. It also
> simplifies the code for `Fprog1' without sacrificing performance.
> diff --git a/src/eval.c b/src/eval.c
> index ddcccc2..7e02838 100644
> --- a/src/eval.c
> +++ b/src/eval.c
> @@ -456,10 +456,17 @@ usage: (progn BODY...) */)
> /* Evaluate BODY sequentially, discarding its value. Suitable for
> record_unwind_protect. */
> +static void
> +progn_ignore (Lisp_Object body)
> +{
> + while (CONSP (body))
> + eval_sub (XCAR (body));
> +}
> +
Doesn't the above code up an infinite loop? `body' appears not to be
changed between iterations of the while.
> void
> unwind_body (Lisp_Object body)
> {
> - Fprogn (body);
> + progn_ignore (body);
> }
> DEFUN ("prog1", Fprog1, Sprog1, 1, UNEVALLED, 0,
> @@ -470,15 +477,8 @@ usage: (prog1 FIRST BODY...) */)
> (Lisp_Object args)
> {
> Lisp_Object val;
> - Lisp_Object args_left;
> -
> - args_left = args;
> - val = args;
> -
> - val = eval_sub (XCAR (args_left));
> - while (CONSP (args_left = XCDR (args_left)))
> - eval_sub (XCAR (args_left));
> -
> + val = eval_sub (XCAR (args));
> + progn_ignore (XCDR (args));
> return val;
> }
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2016-12-27 15:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-27 2:14 Define progn_ignore to run Fprogn and ignore output Chris Gregory
2016-12-27 6:26 ` Eli Zaretskii
2016-12-27 16:28 ` Chris Gregory
2016-12-27 18:45 ` Paul Eggert
2016-12-27 15:49 ` Alan Mackenzie [this message]
2016-12-27 16:28 ` Chris Gregory
-- strict thread matches above, loose matches on Subject: below --
2016-12-28 1:30 Chris Gregory
2016-12-28 6:26 ` Paul Eggert
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161227154947.GA2324@acm.fritz.box \
--to=acm@muc.de \
--cc=czipperz@gmail.com \
--cc=emacs-devel@gnu.org \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.