From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#38206: 26.1; cl-prettyexpand incorrectly expands pushing to structures Date: Sun, 17 Nov 2019 20:19:58 +0100 Message-ID: <87imniux7l.fsf@gnus.org> References: <62949967.3QoF1lfsEv@gabor> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="229136"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 38206@debbugs.gnu.org, Stefan Monnier To: Braun =?UTF-8?Q?G=C3=A1bor?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 17 20:21:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWQ6j-000xRq-JQ for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 20:21:13 +0100 Original-Received: from localhost ([::1]:55832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWQ6i-0007gL-FD for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 14:21:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53092) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWQ6b-0007ca-EQ for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 14:21:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWQ6Z-00039I-7w for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 14:21:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33853) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWQ6Z-00039C-3z for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 14:21:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWQ6X-0005kH-NQ for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 14:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Nov 2019 19:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38206 X-GNU-PR-Package: emacs Original-Received: via spool by 38206-submit@debbugs.gnu.org id=B38206.157401841122012 (code B ref 38206); Sun, 17 Nov 2019 19:21:01 +0000 Original-Received: (at 38206) by debbugs.gnu.org; 17 Nov 2019 19:20:11 +0000 Original-Received: from localhost ([127.0.0.1]:42674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWQ5j-0005iy-0d for submit@debbugs.gnu.org; Sun, 17 Nov 2019 14:20:11 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:52646) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWQ5h-0005ij-Nq for 38206@debbugs.gnu.org; Sun, 17 Nov 2019 14:20:10 -0500 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iWQ5X-0001AR-PC; Sun, 17 Nov 2019 20:20:02 +0100 In-Reply-To: <62949967.3QoF1lfsEv@gabor> ("Braun =?UTF-8?Q?G=C3=A1bor?="'s message of "Thu, 14 Nov 2019 09:20:19 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171850 Archived-At: Braun G=C3=A1bor writes: > (let* ((v test-slot) > (v (or (cl-block test-p > (and (memq (type-of foo) cl-struct-test-tags) t)) > (signal 'wrong-type-argument (list 'test foo)))) > (v (aref foo 1))) > (\(setf\ cl-block\) (cons 1 (cl-block v v v)) v v v)) > > The form in the output is obviously an incorrect expansion of > (push 1 (test-slot foo)). Yup. However, if we give a FULL parameter to the function, it gives the correct results: (cl-prettyexpand '(push 1 (test-slot foo)) t) =3D> (progn (or (and (memq (type-of foo) cl-struct-test-tags) t) (signal 'wrong-type-argument (list 'test foo))) (let* ((v foo)) (aset v 1 (cons 1 (aref v 1))))) The definition is (defun cl-prettyexpand (form &optional full) "Expand macros in FORM and insert the pretty-printed result. Optional argument FULL non-nil means to expand all macros, including `cl-block' and `cl-eval-when'." [...] (setq form (macroexpand-all form (and (not full) '((cl-block) (cl-eval-when)= )))) The bug was introduced by a rewrite in 2012, I think, which changed the implementation radically, which made it pass in that list as a totally bogus ENVIRONMENT to macroexpand-all. I think the right change here is to just deprecate the FULL parameter and remove the=20 (and (not full) '((cl-block) (cl-eval-when)= )))) bit. Stefan? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no