unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64292: 30.0.50; setf strange when lexical-binding is nil
@ 2023-06-26  1:45 Katsumi Yamaoka
  2023-06-27 13:21 ` Mattias Engdegård
  2023-06-28  0:36 ` Katsumi Yamaoka
  0 siblings, 2 replies; 5+ messages in thread
From: Katsumi Yamaoka @ 2023-06-26  1:45 UTC (permalink / raw)
  To: 64292

Hi,

In the *scratch* buffer:

(setq lexical-binding nil)
(require 'nnheader)
(macroexpand '(setf (mail-header-date header) date))
 => (let* ((v #'(lambda (cl-x) (progn (progn (aref cl-x 3)))))
           (v header))
      (\(setf\ funcall\) date v v))

This looks broken, though it gets normal if lexical-binding is t.
Because of this, an old ELisp module doesn't work.  In addition,
the funny portion is replaced with
\(setf\ internal--with-suppressed-warnings\)...
if the code is byte-compiled.

Thanks.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-cygwin, GTK+ Version
 3.22.28, cairo version 1.17.4) of 2023-06-26 built on localhost





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

* bug#64292: 30.0.50; setf strange when lexical-binding is nil
  2023-06-26  1:45 bug#64292: 30.0.50; setf strange when lexical-binding is nil Katsumi Yamaoka
@ 2023-06-27 13:21 ` Mattias Engdegård
  2023-06-27 13:36   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-28  0:36 ` Katsumi Yamaoka
  1 sibling, 1 reply; 5+ messages in thread
From: Mattias Engdegård @ 2023-06-27 13:21 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: Stefan Monnier, 64292

> (setq lexical-binding nil)
> (require 'nnheader)
> (macroexpand '(setf (mail-header-date header) date))
>  => (let* ((v #'(lambda (cl-x) (progn (progn (aref cl-x 3)))))
>            (v header))
>       (\(setf\ funcall\) date v v))
> 
> This looks broken, though it gets normal if lexical-binding is t.
> Because of this, an old ELisp module doesn't work.  In addition,
> the funny portion is replaced with
> \(setf\ internal--with-suppressed-warnings\)...
> if the code is byte-compiled.

This is effectively an encrypted "you should use lexical-binding:t" error message.
Stefan, should we just bypass the suppression here, or the entire `cl--slet` business, in dynbound mode?






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

* bug#64292: 30.0.50; setf strange when lexical-binding is nil
  2023-06-27 13:21 ` Mattias Engdegård
@ 2023-06-27 13:36   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-27 13:36 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: Katsumi Yamaoka, 64292

Mattias Engdegård [2023-06-27 15:21:08] wrote:

>> (setq lexical-binding nil)
>> (require 'nnheader)
>> (macroexpand '(setf (mail-header-date header) date))
>>  => (let* ((v #'(lambda (cl-x) (progn (progn (aref cl-x 3)))))
>>            (v header))
>>       (\(setf\ funcall\) date v v))
>> 
>> This looks broken, though it gets normal if lexical-binding is t.
>> Because of this, an old ELisp module doesn't work.  In addition,
>> the funny portion is replaced with
>> \(setf\ internal--with-suppressed-warnings\)...
>> if the code is byte-compiled.
>
> This is effectively an encrypted "you should use lexical-binding:t" error message.
> Stefan, should we just bypass the suppression here, or the entire `cl--slet`
> business, in dynbound mode?

Can someone confirm that the patch below reverts the regression?


        Stefan


diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index aadb498609a..eed7199fcc2 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -247,9 +247,10 @@ cl--slet
   "Like `cl--slet*' but for \"parallel let\"."
   (let ((dyns nil)) ;Vars declared as dynbound among the bindings?
     ;; `seq-some' lead to bootstrap problems.
-    (dolist (binding bindings)
-      (when (macroexp--dynamic-variable-p (car binding))
-        (push (car binding) dyns)))
+    (when lexical-binding
+      (dolist (binding bindings)
+        (when (macroexp--dynamic-variable-p (car binding))
+          (push (car binding) dyns))))
     (cond
      (dyns
       (let ((form `(funcall (lambda (,@(mapcar #'car bindings))






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

* bug#64292: 30.0.50; setf strange when lexical-binding is nil
  2023-06-26  1:45 bug#64292: 30.0.50; setf strange when lexical-binding is nil Katsumi Yamaoka
  2023-06-27 13:21 ` Mattias Engdegård
@ 2023-06-28  0:36 ` Katsumi Yamaoka
  2023-06-28 13:36   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 5+ messages in thread
From: Katsumi Yamaoka @ 2023-06-28  0:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: mattias.engdegard, 64292

On Tue, 27 Jun 2023 09:36:07 -0400, Stefan Monnier wrote:
> Can someone confirm that the patch below reverts the regression?

The patch did the trick on at least the setf issue.  Thanks.





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

* bug#64292: 30.0.50; setf strange when lexical-binding is nil
  2023-06-28  0:36 ` Katsumi Yamaoka
@ 2023-06-28 13:36   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-28 13:36 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: mattias.engdegard, 64292

>> Can someone confirm that the patch below reverts the regression?
> The patch did the trick on at least the setf issue.  Thanks.

I pushed it to `master` (under the "bug#64315" name, tho, didn't
realize there were not the same bug numbers).


        Stefan






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

end of thread, other threads:[~2023-06-28 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26  1:45 bug#64292: 30.0.50; setf strange when lexical-binding is nil Katsumi Yamaoka
2023-06-27 13:21 ` Mattias Engdegård
2023-06-27 13:36   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-28  0:36 ` Katsumi Yamaoka
2023-06-28 13:36   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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