GNU bug report logs - #64292
30.0.50; setf strange when lexical-binding is nil

Previous Next

Package: emacs;

Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>

Date: Mon, 26 Jun 2023 01:46:02 UTC

Severity: normal

Merged with 64315

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64292 in the body.
You can then email your comments to 64292 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#64292; Package emacs. (Mon, 26 Jun 2023 01:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 26 Jun 2023 01:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; setf strange when lexical-binding is nil
Date: Mon, 26 Jun 2023 10:45:34 +0900
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64292; Package emacs. (Tue, 27 Jun 2023 13:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 64292 <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 64292 <at> debbugs.gnu.org
Subject: bug#64292: 30.0.50; setf strange when lexical-binding is nil
Date: Tue, 27 Jun 2023 15:21:08 +0200
> (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?





Merged 64292 64315. Request was from Mattias Engdegård <mattias.engdegard <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 27 Jun 2023 13:24:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64292; Package emacs. (Tue, 27 Jun 2023 13:37:01 GMT) Full text and rfc822 format available.

Message #13 received at 64292 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: Katsumi Yamaoka <yamaoka <at> jpl.org>, 64292 <at> debbugs.gnu.org
Subject: Re: bug#64292: 30.0.50; setf strange when lexical-binding is nil
Date: Tue, 27 Jun 2023 09:36:07 -0400
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))





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64292; Package emacs. (Wed, 28 Jun 2023 00:37:02 GMT) Full text and rfc822 format available.

Message #16 received at 64292 <at> debbugs.gnu.org (full text, mbox):

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: mattias.engdegard <at> gmail.com, 64292 <at> debbugs.gnu.org
Subject: Re: bug#64292: 30.0.50; setf strange when lexical-binding is nil
Date: Wed, 28 Jun 2023 09:36:12 +0900
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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64292; Package emacs. (Wed, 28 Jun 2023 13:37:02 GMT) Full text and rfc822 format available.

Message #19 received at 64292 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: mattias.engdegard <at> gmail.com, 64292 <at> debbugs.gnu.org
Subject: Re: bug#64292: 30.0.50; setf strange when lexical-binding is nil
Date: Wed, 28 Jun 2023 09:36:40 -0400
>> 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64292; Package emacs. (Wed, 28 Jun 2023 14:29:02 GMT) Full text and rfc822 format available.

Message #22 received at 64292 <at> debbugs.gnu.org (full text, mbox):

From: Corwin Brust <corwin <at> bru.st>
To: Ramón Lorenzo Panadés-Barrueta <rpana92 <at> gmail.com>
Cc: 64292 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: yasnippets block last emacs
Date: Wed, 28 Jun 2023 09:27:59 -0500
On Wed, Jun 28, 2023 at 7:08 AM Ramón Lorenzo Panadés-Barrueta
<rpana92 <at> gmail.com> wrote:
>
> > yas--template-menu-binding-pair-get-create: Symbol's function definition is
> > void: \(setf\
> > internal--with-suppressed-warnings\)
> >

[snip]

> I opened an issue in the yasnippets' GitHub site,
> https://github.com/joaotavora/yasnippet/issues/1166. One user found that
>
> adding lexical-binding: t in yasnippets.el workarounds the issue. Source:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64292.

Stephen M has just pushed changes to master that appear to address
this.  Would you like to confirm?

Here's a summary of the commit:

> branch:master rev:dcd920 who:monnier where:emacs-30 what:lisp/emacs-lisp/cl-macs.el (cl--slet): Fix bug#64315

Note, the commit message should probably reference 64292, which
tracker I've cross-posted to.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64292; Package emacs. (Thu, 29 Jun 2023 00:27:01 GMT) Full text and rfc822 format available.

Message #25 received at 64292-done <at> debbugs.gnu.org (full text, mbox):

From: Corwin Brust <corwin <at> bru.st>
To: 64292-done <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: yasnippets block last emacs
Date: Wed, 28 Jun 2023 19:25:52 -0500
Thank you.  Several other packages (for example use-package) were also
affected.

Seeing below a second confirmation that the fix applied for bug#64315
(already closed) has generally resolved the problem, I'm therefore
also closing this bug. Feel free to re-open it if you believe
something may have been missed.

On Wed, Jun 28, 2023 at 3:26 PM Ramón Lorenzo Panadés-Barrueta
<rpana92 <at> gmail.com> wrote:
>
> I can confirm that rev:dcd920 fixed the bug. Thanks for the heads-up!
>
> El mié, 28 jun 2023 a las 16:28, Corwin Brust (<corwin <at> bru.st>) escribió:
>>
>> On Wed, Jun 28, 2023 at 7:08 AM Ramón Lorenzo Panadés-Barrueta
>> <rpana92 <at> gmail.com> wrote:
>> >
>> > > yas--template-menu-binding-pair-get-create: Symbol's function definition is
>> > > void: \(setf\
>> > > internal--with-suppressed-warnings\)
>> > >
>>
>> [snip]
>>
>> > I opened an issue in the yasnippets' GitHub site,
>> > https://github.com/joaotavora/yasnippet/issues/1166. One user found that
>> >
>> > adding lexical-binding: t in yasnippets.el workarounds the issue. Source:
>> > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64292.
>>
>> Stephen M has just pushed changes to master that appear to address
>> this.  Would you like to confirm?
>>
>> Here's a summary of the commit:
>>
>> > branch:master rev:dcd920 who:monnier where:emacs-30 what:lisp/emacs-lisp/cl-macs.el (cl--slet): Fix bug#64315
>>
>> Note, the commit message should probably reference 64292, which
>> tracker I've cross-posted to.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 27 Jul 2023 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 332 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.