From: Chris Gregory <czipperz@gmail.com>
To: emacs-devel@gnu.org
Subject: Define progn_ignore to run Fprogn and ignore output
Date: Mon, 26 Dec 2016 20:14:47 -0600 [thread overview]
Message-ID: <871swum82w.fsf@CzipperZag.i-did-not-set--mail-host-address--so-tickle-me> (raw)
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));
+}
+
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;
}
next reply other threads:[~2016-12-27 2:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-27 2:14 Chris Gregory [this message]
2016-12-27 6:26 ` Define progn_ignore to run Fprogn and ignore output 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
-- 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=871swum82w.fsf@CzipperZag.i-did-not-set--mail-host-address--so-tickle-me \
--to=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.