unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once
@ 2020-02-04 21:05 Tino Calancha
  2020-02-04 21:15 ` dick.r.chiang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tino Calancha @ 2020-02-04 21:05 UTC (permalink / raw)
  To: 39428; +Cc: stefan monnier, dick.r.chiang

X-Debbugs-Cc: Stefan Monnier <monnier@iro.umontreal.ca>,dick.r.chiang@gmail.com

I think this little tweak has sense.  WDYT?


--8<-----------------------------cut here---------------start------------->8---
commit eb88afb89a8cfb760d89569e74c8ece1d1c446cb
Author: Tino Calancha <tino.calancha@gmail.com>
Date:   Tue Feb 4 21:52:06 2020 +0100

    Eval macro arg just once
    
    * lisp/emacs-lisp/cl-macs.el (cl--push-clause-loop-body):
    Use `macroexp-let2'.

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 9d0fd15bc3..4c2f58907d 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1037,9 +1037,10 @@ cl-loop
 
 (defmacro cl--push-clause-loop-body (clause)
   "Apply CLAUSE to both `cl--loop-conditions' and `cl--loop-body'."
-  `(progn
-     (push ,clause cl--loop-conditions)
-     (push ,clause cl--loop-body)))
+  (macroexp-let2 nil sym clause
+    `(progn
+       (push ,sym cl--loop-conditions)
+       (push ,sym cl--loop-body))))
 
 ;; Below is a complete spec for cl-loop, in several parts that correspond
 ;; to the syntax given in CLtL2.  The specs do more than specify where

--8<-----------------------------cut here---------------end--------------->8---


In GNU Emacs 28.0.50 (build 21, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-02-04 built on calancha-pc.dy.bbexcite.jp
Repository revision: e287da5a8154d83a97107b64915ccc17e3a086b8
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once
  2020-02-04 21:05 bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once Tino Calancha
@ 2020-02-04 21:15 ` dick.r.chiang
  2020-02-05 18:08   ` Tino Calancha
  2020-02-05  0:26 ` Stefan Monnier
  2020-02-05 18:08 ` Tino Calancha
  2 siblings, 1 reply; 7+ messages in thread
From: dick.r.chiang @ 2020-02-04 21:15 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 39428, stefan monnier

LGTM, thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once
  2020-02-04 21:05 bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once Tino Calancha
  2020-02-04 21:15 ` dick.r.chiang
@ 2020-02-05  0:26 ` Stefan Monnier
  2020-02-05 18:03   ` Tino Calancha
  2020-02-05 18:08 ` Tino Calancha
  2 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2020-02-05  0:26 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 39428, dick.r.chiang

> I think this little tweak has sense.  WDYT?

Yes, it looks good (tho I must say I don't really understand what
cl--loop-conditions and cl--loop-body are for and even less why we'd
want to push the same clause onto both lists).


        Stefan






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once
  2020-02-05  0:26 ` Stefan Monnier
@ 2020-02-05 18:03   ` Tino Calancha
  0 siblings, 0 replies; 7+ messages in thread
From: Tino Calancha @ 2020-02-05 18:03 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 39428, dick.r.chiang

Stefan Monnier <monnier@iro.umontreal.ca> writes:
> I must say I don't really understand what
> cl--loop-conditions and cl--loop-body are for and even less why we'd
> want to push the same clause onto both lists

Those things came from bug#29799.  I have not followed the latest
changes in that report; the purpose seems to cover some
edge cases.  It has no impact on our test suite; furthermore, they
have added new tests for those edge cases matching what clisp does.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once
  2020-02-04 21:15 ` dick.r.chiang
@ 2020-02-05 18:08   ` Tino Calancha
  0 siblings, 0 replies; 7+ messages in thread
From: Tino Calancha @ 2020-02-05 18:08 UTC (permalink / raw)
  To: 39428-done

dick.r.chiang@gmail.com writes:

> LGTM, thanks.

Pushed at master branch as commit 'Eval macro arg just once'
(ebff24c0b8fa54854fe8445f2eba1d99fb76ecf2)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once
  2020-02-04 21:05 bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once Tino Calancha
  2020-02-04 21:15 ` dick.r.chiang
  2020-02-05  0:26 ` Stefan Monnier
@ 2020-02-05 18:08 ` Tino Calancha
  2020-02-05 18:35   ` Eli Zaretskii
  2 siblings, 1 reply; 7+ messages in thread
From: Tino Calancha @ 2020-02-05 18:08 UTC (permalink / raw)
  To: eliz; +Cc: 39428

Tino Calancha <tino.calancha@gmail.com> writes:

> LGTM, thanks.
>Pushed at master branch as commit 'Eval macro arg just once'
>(ebff24c0b8fa54854fe8445f2eba1d99fb76ecf2)
Eli, I have noticed that, even if I opened this report for emacs master,
the code is also at emacs-27.
Do we need to cherry pick this fix to emacs-27 now?
Or should we wait after the release?
IMO, it's not urgent, I mean, I have not a case where it's
breaking something; it's simply more correct, because you are
protected from unwanted side-effects.
Message-ID: <874kw4nb7m.fsf@calancha-pc.dy.bbexcite.jp>





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once
  2020-02-05 18:08 ` Tino Calancha
@ 2020-02-05 18:35   ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-02-05 18:35 UTC (permalink / raw)
  To: Tino Calancha; +Cc: 39428

> From: Tino Calancha <tino.calancha@gmail.com>
> Cc: 39428@debbugs.gnu.org
> Date: Wed, 05 Feb 2020 19:08:42 +0100 (5 minutes, 25 seconds ago)
> 
> >Pushed at master branch as commit 'Eval macro arg just once'
> >(ebff24c0b8fa54854fe8445f2eba1d99fb76ecf2)
> Eli, I have noticed that, even if I opened this report for emacs master,
> the code is also at emacs-27.
> Do we need to cherry pick this fix to emacs-27 now?

I don't see a need, this doesn't seem to be serious enough to have in
Emacs 27.

> IMO, it's not urgent, I mean, I have not a case where it's
> breaking something; it's simply more correct, because you are
> protected from unwanted side-effects.

Then it's definitely for master.

Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-05 18:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-04 21:05 bug#39428: 28.0.50; cl--push-clause-loop-body: eval macro arg just once Tino Calancha
2020-02-04 21:15 ` dick.r.chiang
2020-02-05 18:08   ` Tino Calancha
2020-02-05  0:26 ` Stefan Monnier
2020-02-05 18:03   ` Tino Calancha
2020-02-05 18:08 ` Tino Calancha
2020-02-05 18:35   ` Eli Zaretskii

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).