From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Chris Gregory Newsgroups: gmane.emacs.devel Subject: Define progn_ignore to run Fprogn and ignore output Date: Mon, 26 Dec 2016 20:14:47 -0600 Message-ID: <871swum82w.fsf@CzipperZag.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1482806368 12912 195.159.176.226 (27 Dec 2016 02:39:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Dec 2016 02:39:28 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 27 03:39:24 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLhff-0002jy-Um for ged-emacs-devel@m.gmane.org; Tue, 27 Dec 2016 03:39:24 +0100 Original-Received: from localhost ([::1]:52475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLhfk-0003WP-Ok for ged-emacs-devel@m.gmane.org; Mon, 26 Dec 2016 21:39:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLhI7-0001Tk-NZ for emacs-devel@gnu.org; Mon, 26 Dec 2016 21:15:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLhI6-0001vw-TN for emacs-devel@gnu.org; Mon, 26 Dec 2016 21:15:03 -0500 Original-Received: from mail-it0-x242.google.com ([2607:f8b0:4001:c0b::242]:35226) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cLhI6-0001vR-O7 for emacs-devel@gnu.org; Mon, 26 Dec 2016 21:15:02 -0500 Original-Received: by mail-it0-x242.google.com with SMTP id b123so32452319itb.2 for ; Mon, 26 Dec 2016 18:15:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=bELuiZbpZFkMT8G0M4vkOT4uoMMAyTonEsFj3NSycBI=; b=gNXQS1RiCmKDtyg27ga3eEaAV1MyqwcjxpWyVYsVQOm/NcFGTYVe+XJva9MatawIB3 kxauuBJpmbB06iC/Fzoj9RSYA4zWQn+iH9kl+LKIm3Sj22knNUztW7caWSx47QydlTLC 2i8ZhrV/jHxwkDIajRp/gREF7/8CUZEhEn4TwR0hNXNTE3FSpcmn3a7ORepffFjl1MWF JggVUelgd2vJ9KP05mCn7hRTkTM+xE8Ex77idKiEwRei3KnUPUAb407yVwpPMcnZM73B QQ5fORnmQTH5Ed3ZweYtiV/B5wF0EYXYInIfiVyHqpZol/n3Fku7fNzDwskciBW2HKdA 9pgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=bELuiZbpZFkMT8G0M4vkOT4uoMMAyTonEsFj3NSycBI=; b=gbxb727JgBZsCGP+v6OPBomklMKUtoBOJ7WSJFC92n1MUBY4vrCQz2wpovAtju+IJU 0dt8NEmGYY48D5LCPBlPMxx0mQ0pnpzb8+oRKn2D+83zi/GY/7lC7BAC/6AiGCGCEg/+ lwTg1lDvGGsho54zWAyXxQohIFRuZAKvdgHJyufp4ICyMwuxyg9UC03IHeHUFw+uujpG i5YCYydRLCCPlZ87Q9TxkRn2zRD+JJ0N99R79aFYnhm7YvfNYy8PpRfSVEJE/wdZn/b3 2+EeNsfHn2bBCYqONIHV9PdayW1ZGHRRuVCYT8MGLZJerzUz5tZnT0Fp9L+xw/QOVdM7 T6vA== X-Gm-Message-State: AIkVDXIfjRwks89x8MartTp/xjnBuWbJJSKQalEazcRPdpSx0Rd3bbO2kpgNymek0MoQCg== X-Received: by 10.36.254.74 with SMTP id w71mr23298112ith.38.1482804900442; Mon, 26 Dec 2016 18:15:00 -0800 (PST) Original-Received: from CzipperZag ([2604:2d80:8039:81de:a0b5:3d06:3bb2:d546]) by smtp.gmail.com with ESMTPSA id h17sm19917334ith.17.2016.12.26.18.14.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Dec 2016 18:15:00 -0800 (PST) X-Google-Original-From: Chris Gregory X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4001:c0b::242 X-Mailman-Approved-At: Mon, 26 Dec 2016 21:38:36 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210828 Archived-At: 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; }