From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Understanding macroexp.el Date: Wed, 18 Nov 2015 11:32:22 +0100 Message-ID: <87h9kjd2dl.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1447842769 3795 80.91.229.3 (18 Nov 2015 10:32:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Nov 2015 10:32:49 +0000 (UTC) Cc: Stefan Monnier To: Emacs Development Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 18 11:32:41 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zz02Z-000213-8v for ged-emacs-devel@m.gmane.org; Wed, 18 Nov 2015 11:32:39 +0100 Original-Received: from localhost ([::1]:35032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz02Y-0004ZP-Ah for ged-emacs-devel@m.gmane.org; Wed, 18 Nov 2015 05:32:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz02U-0004Ws-D2 for emacs-devel@gnu.org; Wed, 18 Nov 2015 05:32:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz02R-00033i-2X for emacs-devel@gnu.org; Wed, 18 Nov 2015 05:32:34 -0500 Original-Received: from mout.web.de ([212.227.15.4]:52874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz02Q-000339-PO for emacs-devel@gnu.org; Wed, 18 Nov 2015 05:32:31 -0500 Original-Received: from drachen.dragon ([90.186.3.35]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0Lv7eE-1aQ3453BJq-010Izf; Wed, 18 Nov 2015 11:32:28 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-Provags-ID: V03:K0:AN6peudPX6RRtWuthRBdJLkjLCZ6shG1jPijJ+1tqpt589jmV4f zJEWH7OatOhEsEFtKxKxniibI1bdKQqFCxoFdEaGqhm0vw2t/nR6BNpTvHYQ8T0udKU3SWE FB4Yb3xpFVsW/n/p5N691BPaZICZqbXqmG0HmcomA5jzHmoKrkcG6cDJ7OFlLKA2YxTAH71 6R9LDHePF1AAefuDrVX8Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:NPqmCbT9PV0=:WJQ+x6O/VwkM7vAEi4+aZa L2dIRQ4IkIdZntMXrF+gQMsh8QMpMHmutln0Unx1H21ewlNeIh5grnEvPwoBl3K4faSS5W/4b SUI9qg12bQaZ9heurzV27Zd2N1vSoLROwjJ1AMnvVVuwUF1sIoM/3OxFwPqyNZ2DjUMDmdzxB C+k86SAD0+iLHk0WulxEaPG0Mc1Vf0YMpwPg0Ff7pIiUTREiH90WG91/7WlBcFcdbbu30jpeu C8blgP1cPkwY1hxrH3j76YjCDcTuPMSntlPuyoZjT46ATdZAwQWopawqQQslVQFu2wTBffMZm tiGkvVDlX0wzwvkWNRFM42+cXG6CSlHTBYkvZvDbtPCRo8hf+6vQlTBc96IJJN6hnQFknGD8C +GY2Saeepv3SNMHtb+6AZfMZIzHveJsb0icPWHsPxpNujnY+Wp4K3tZ0y6MpZE/ChmecKyOkB FGTezquTpdVelax+U/Xk9+5yMX2M84VsDLqDaVh7teVGa1mxk8YPRQr6/wfbxkX3uil/96us6 iMHBGZzM0UFka8Y9pZ8icOnTEC5VlaJ12S9dYe60BfrmosUndAAk+R3+bVF3/EtlSgJly7105 C/t32LkDL+n2DYwJZNafF0e16+ndS4mIveoCCBK9Zc2SacOY7jc4+KHfvGUSZGZyDxwvRhZMW mCrrpVy5bG6iqHrHAAXsdZnbLOpEyTGkAXzlS0WSqlJ21alXSLAnVlGde9+iBXyHP2NM00oD3 v3bHIqaQHGWJKDA9r8gXQ7PNb7TJ3+8zvLFypbKtnmrMFnMQ+0O/LYIebbbTLbKh0pb8mtlq X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:194696 Archived-At: --=-=-= Content-Type: text/plain Hello, yesterday I tried to understand the helpers in macroexp.el. I have a question: Would it make sense to install the following: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=macroexp.patch *** /tmp/ediff139941AX 2015-11-18 11:12:07.788012282 +0100 --- /home/micha/software/emacs/lisp/emacs-lisp/macroexp.el 2015-11-18 10:47:41.041352909 +0100 *************** *** 331,337 **** (cond ((null bindings) exp) ((eq 'let* (car-safe exp)) `(let* (,@bindings ,@(cadr exp)) ,@(cddr exp))) ! (t `(let* ,bindings ,exp)))) (defun macroexp-if (test then else) "Return an expression equivalent to `(if ,TEST ,THEN ,ELSE)." --- 331,337 ---- (cond ((null bindings) exp) ((eq 'let* (car-safe exp)) `(let* (,@bindings ,@(cadr exp)) ,@(cddr exp))) ! (t `(let* ,bindings ,@(macroexp-unprogn exp))))) (defun macroexp-if (test then else) "Return an expression equivalent to `(if ,TEST ,THEN ,ELSE)." --=-=-= Content-Type: text/plain Here is an example where it matters: (defmacro test (exp) (macroexp-let2 nil res exp `(progn (f ,res) (g ,res)))) (note that the `progn' is mandatory here.) Without the patch: (macroexpand '(test (+ 1 2))) ==> (let* ((#:res #1=(+ 1 2))) (progn (f #1#) (g #1#))) After patch: (macroexpand '(test (+ 1 2))) ==> (let* ((#:res #1=(+ 1 2))) (f #1#) (g #1#)) (And is it currently allowed to push this to master?) Thanks, Michael. --=-=-=--