From: Chris Gregory <czipperz@gmail.com>
To: Alan Mackenzie <acm@muc.de>
Cc: Emacs Development Mailing List <emacs-devel@gnu.org>
Subject: Re: Define progn_ignore to run Fprogn and ignore output
Date: Tue, 27 Dec 2016 10:28:48 -0600 [thread overview]
Message-ID: <CAH6RvXj-LpQJz1HotfTp2eocwpPUB=GyDPLgLB9AKS71SHdBmg@mail.gmail.com> (raw)
In-Reply-To: <20161227154947.GA2324@acm.fritz.box>
[-- Attachment #1: Type: text/plain, Size: 1677 bytes --]
Oh yes you are correct. That's my bad.
Sincerely,
Chris Gregory
On Tue, Dec 27, 2016 at 9:49 AM, Alan Mackenzie <acm@muc.de> wrote:
> 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).
>
[-- Attachment #2: Type: text/html, Size: 2803 bytes --]
next prev parent reply other threads:[~2016-12-27 16:28 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
2016-12-27 16:28 ` Chris Gregory [this message]
-- 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
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='CAH6RvXj-LpQJz1HotfTp2eocwpPUB=GyDPLgLB9AKS71SHdBmg@mail.gmail.com' \
--to=czipperz@gmail.com \
--cc=acm@muc.de \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).