GNU bug report logs - #69270
29.1; transient.el: Using `transient-define-prefix' with a lambda command results in warning

Previous Next

Package: emacs;

Reported by: Fadi Moukayed <smfadi <at> gmail.com>

Date: Mon, 19 Feb 2024 11:38:02 UTC

Severity: minor

Found in version 29.1

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 69270 in the body.
You can then email your comments to 69270 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#69270; Package emacs. (Mon, 19 Feb 2024 11:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fadi Moukayed <smfadi <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Feb 2024 11:38:02 GMT) Full text and rfc822 format available.

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

From: Fadi Moukayed <smfadi <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.1; transient.el: Using `transient-define-prefix' with a lambda
 command results in warning
Date: Mon, 19 Feb 2024 11:45:25 +0100
Mentioned on the #emacs channel (libera).

As per https://www.gnu.org/software/emacs/manual/html_mono/transient.html#Suffix-Specifications
– it is mentioned that "COMMAND can also be a lambda expression."

However, evaluating the form (even on an Emacs instance started with "emacs -Q")

  (transient-define-prefix my-test-transient () ["Heading" ("a"
"choice a" (lambda () (interactive)))])

Results in the following warning being printed on the *Messages* buffer:

  Warning: (lambda nil \...) quoted with ' rather than with #'

Attempting to hashquote the lambda as in:

  (transient-define-prefix my-test-transient () ["Heading" ("a"
"choice a" (lambda () (interactive)))])

... as suggested by some on #emacs results in an error when evaluating.

At this point, I am not sure if this is an error in documentation of
transient.el, or an error in the macro definition of the
`transient-define-prefix' macro itself, or if the warning is
superfluous and whether it should be ignored. As I'm unsure whether
this is a bug or not, I'm erring on the side of safety and reporting
it to bring it to attention.

In GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
 cairo version 1.16.0) of 2023-12-10 built on lcy02-amd64-098
Repository revision: 28fb02492c2444c5976eb53fd6f9badfe54f4ea1
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12201001
System Description: Ubuntu 22.04.4 LTS

Configured using:
 'configure --prefix=/snap/emacs/current/usr --with-x-toolkit=gtk3
 --without-xaw3d --with-modules --with-cairo
 --with-native-compilation=aot --with-xinput2 --with-tree-sitter
 --with-json
 'CFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
 -isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
 -isystem/build/emacs/stage/usr/include -O2'
 'CPPFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
 -isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
 -isystem/build/emacs/stage/usr/include'
 'LDFLAGS=-L/build/emacs/parts/emacs/install/lib
 -L/build/emacs/parts/emacs/install/usr/lib
 -L/build/emacs/parts/emacs/install/lib/x86_64-linux-gnu
 -L/build/emacs/parts/emacs/install/usr/lib/x86_64-linux-gnu
 -L/build/emacs/stage/usr/lib''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM
GTK3 ZLIB

Important settings:
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  electric-pair-mode: t
  display-line-numbers-mode: t
  erc-ring-mode: t
  erc-notifications-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-list-mode: t
  erc-irccontrols-mode: t
  erc-keep-place-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  erc-imenu-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-bufbar-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-autojoin-mode: t
  recentf-mode: t
  pixel-scroll-precision-mode: t
  minibuffer-depth-indicate-mode: t
  global-whitespace-mode: t
  global-goto-address-mode: t
  goto-address-mode: t
  global-auto-revert-mode: t
  fido-vertical-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  fido-mode: t
  erc-networks-mode: t
  desktop-save-mode: t
  windmove-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  prettify-symbols-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69270; Package emacs. (Mon, 19 Feb 2024 13:06:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Fadi Moukayed <smfadi <at> gmail.com>, jonas <at> bernoul.li
Cc: 69270 <at> debbugs.gnu.org
Subject: Re: bug#69270: 29.1;
 transient.el: Using `transient-define-prefix' with a lambda command
 results in warning
Date: Mon, 19 Feb 2024 15:05:23 +0200
> From: Fadi Moukayed <smfadi <at> gmail.com>
> Date: Mon, 19 Feb 2024 11:45:25 +0100
> 
> Mentioned on the #emacs channel (libera).
> 
> As per https://www.gnu.org/software/emacs/manual/html_mono/transient.html#Suffix-Specifications
> – it is mentioned that "COMMAND can also be a lambda expression."
> 
> However, evaluating the form (even on an Emacs instance started with "emacs -Q")
> 
>   (transient-define-prefix my-test-transient () ["Heading" ("a"
> "choice a" (lambda () (interactive)))])
> 
> Results in the following warning being printed on the *Messages* buffer:
> 
>   Warning: (lambda nil \...) quoted with ' rather than with #'
> 
> Attempting to hashquote the lambda as in:
> 
>   (transient-define-prefix my-test-transient () ["Heading" ("a"
> "choice a" (lambda () (interactive)))])
> 
> ... as suggested by some on #emacs results in an error when evaluating.
> 
> At this point, I am not sure if this is an error in documentation of
> transient.el, or an error in the macro definition of the
> `transient-define-prefix' macro itself, or if the warning is
> superfluous and whether it should be ignored. As I'm unsure whether
> this is a bug or not, I'm erring on the side of safety and reporting
> it to bring it to attention.

Jonas, could you please look into this?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69270; Package emacs. (Sat, 01 Mar 2025 03:23:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Fadi Moukayed <smfadi <at> gmail.com>, jonas <at> bernoul.li, 69270 <at> debbugs.gnu.org
Subject: Re: bug#69270: 29.1; transient.el: Using `transient-define-prefix'
 with a lambda command results in warning
Date: Fri, 28 Feb 2025 19:21:57 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Fadi Moukayed <smfadi <at> gmail.com>
>> Date: Mon, 19 Feb 2024 11:45:25 +0100
>>
>> Mentioned on the #emacs channel (libera).
>>
>> As per https://www.gnu.org/software/emacs/manual/html_mono/transient.html#Suffix-Specifications
>> – it is mentioned that "COMMAND can also be a lambda expression."
>>
>> However, evaluating the form (even on an Emacs instance started with "emacs -Q")
>>
>>   (transient-define-prefix my-test-transient () ["Heading" ("a"
>> "choice a" (lambda () (interactive)))])
>>
>> Results in the following warning being printed on the *Messages* buffer:
>>
>>   Warning: (lambda nil \...) quoted with ' rather than with #'
>>
>> Attempting to hashquote the lambda as in:
>>
>>   (transient-define-prefix my-test-transient () ["Heading" ("a"
>> "choice a" (lambda () (interactive)))])
>>
>> ... as suggested by some on #emacs results in an error when evaluating.
>>
>> At this point, I am not sure if this is an error in documentation of
>> transient.el, or an error in the macro definition of the
>> `transient-define-prefix' macro itself, or if the warning is
>> superfluous and whether it should be ignored. As I'm unsure whether
>> this is a bug or not, I'm erring on the side of safety and reporting
>> it to bring it to attention.
>
> Jonas, could you please look into this?

Friendly ping.  Jonas, WDYT?




Severity set to 'minor' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 01 Mar 2025 03:23:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69270; Package emacs. (Sat, 01 Mar 2025 15:46:02 GMT) Full text and rfc822 format available.

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

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: Eli Zaretskii <eliz <at> gnu.org>, Fadi Moukayed <smfadi <at> gmail.com>
Cc: 69270 <at> debbugs.gnu.org
Subject: Re: bug#69270: 29.1; transient.el: Using `transient-define-prefix'
 with a lambda command results in warning
Date: Sat, 01 Mar 2025 16:45:05 +0100
> Jonas, could you please look into this?

This is an issue in the Transient version bundled with Emacs 29.1.
It has been fixed since.  I don't remember when exactly it was fixed.
Maybe other 29.* releases are affected too, 30.1 is not.

Users who are bothered by this warning, who also want to stay on a 29.*
release, can install Transient from GNU ELPA.  Alternatively they can
ignore this warning; it points at an actual issue, but it is harmless.

(They should update to recent Transient release anyway.  There *are*
serious issues in past Transient releases, which are distributed with
past Emacs releases, but the warning at hand is not that.

I do make sure to keep current Transient release compatible with Emacs
releases starting with 28.1, the first release that bundled Transient,
so it is safe to use a recent Transient with an old Emacs.)

>> From: Fadi Moukayed <smfadi <at> gmail.com>
>> Date: Mon, 19 Feb 2024 11:45:25 +0100
>> 
>> Mentioned on the #emacs channel (libera).
>> 
>> As per https://www.gnu.org/software/emacs/manual/html_mono/transient.html#Suffix-Specifications
>> – it is mentioned that "COMMAND can also be a lambda expression."
>> 
>> However, evaluating the form (even on an Emacs instance started with "emacs -Q")
>> 
>>   (transient-define-prefix my-test-transient () ["Heading" ("a"
>> "choice a" (lambda () (interactive)))])
>> 
>> Results in the following warning being printed on the *Messages* buffer:
>> 
>>   Warning: (lambda nil \...) quoted with ' rather than with #'

Back in the 29.1 days, such embedded lambda were wrongly quoted by the
code that turned the group specification into actual code.  As a result
the lambda were not compiled and instead evaluated every time the lambda
is called.  The lambda still worked correctly but was a teeny tiny bit
less efficient.  Of course it is something that should be fixed (it is
no just immeasurably slower, but wrong™), and by now that has happened.

The byte-compiler noticed the issue and warns about this harmless, but
embarrassing issue.

>> Attempting to hashquote the lambda as in:
>> 
>>   (transient-define-prefix my-test-transient () ["Heading" ("a"
>> "choice a" (lambda () (interactive)))])
>> 
>> ... as suggested by some on #emacs results in an error when
>> evaluating.

Yes, that does not work here.  The evaluation rules are a bit different
in these group specification vectors than elsewhere.  To an extend, I
now regret having gone that way, but it is too late to change that now.

If I were to start over, I might require explicit unquoting:

(transient-define-prefix my-test-transient ()
  `["Heading"
    ("a" "choice a" ,(lambda () (interactive)))])

Alas, that is not how it works now.  This is a vector, so nothing in it
has to be quoted.  (If you do quote something, as you have attempted,
that doesn't work, because you end up with something that is quoted
twice.)

The embedded lambda *should* be evaluated, so in more recent Transient
versions, when the prefix is defined, we look for lambda in these
vectors, and make special arrangements for those to be treated as code
and not data.

Back in the 29.1 days that wasn't done yet, and that is what the warning
is about.

>> At this point, I am not sure if this is an error in documentation of
>> transient.el, or an error in the macro definition of the
>> `transient-define-prefix' macro itself, or if the warning is
>> superfluous and whether it should be ignored. As I'm unsure whether
>> this is a bug or not, I'm erring on the side of safety and reporting
>> it to bring it to attention.

It is harmless and can be ignored.

This bug report can be closed.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 01 Mar 2025 15:53:01 GMT) Full text and rfc822 format available.

Notification sent to Fadi Moukayed <smfadi <at> gmail.com>:
bug acknowledged by developer. (Sat, 01 Mar 2025 15:53:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jonas Bernoulli <jonas <at> bernoul.li>
Cc: smfadi <at> gmail.com, 69270-done <at> debbugs.gnu.org
Subject: Re: bug#69270: 29.1; transient.el: Using `transient-define-prefix'
 with a lambda command results in warning
Date: Sat, 01 Mar 2025 17:52:33 +0200
> From: Jonas Bernoulli <jonas <at> bernoul.li>
> Cc: 69270 <at> debbugs.gnu.org
> Date: Sat, 01 Mar 2025 16:45:05 +0100
> 
> > Jonas, could you please look into this?
> 
> This is an issue in the Transient version bundled with Emacs 29.1.
> It has been fixed since.  I don't remember when exactly it was fixed.
> Maybe other 29.* releases are affected too, 30.1 is not.
> 
> Users who are bothered by this warning, who also want to stay on a 29.*
> release, can install Transient from GNU ELPA.  Alternatively they can
> ignore this warning; it points at an actual issue, but it is harmless.
> 
> (They should update to recent Transient release anyway.  There *are*
> serious issues in past Transient releases, which are distributed with
> past Emacs releases, but the warning at hand is not that.
> 
> I do make sure to keep current Transient release compatible with Emacs
> releases starting with 28.1, the first release that bundled Transient,
> so it is safe to use a recent Transient with an old Emacs.)
> 
> >> From: Fadi Moukayed <smfadi <at> gmail.com>
> >> Date: Mon, 19 Feb 2024 11:45:25 +0100
> >> 
> >> Mentioned on the #emacs channel (libera).
> >> 
> >> As per https://www.gnu.org/software/emacs/manual/html_mono/transient.html#Suffix-Specifications
> >> – it is mentioned that "COMMAND can also be a lambda expression."
> >> 
> >> However, evaluating the form (even on an Emacs instance started with "emacs -Q")
> >> 
> >>   (transient-define-prefix my-test-transient () ["Heading" ("a"
> >> "choice a" (lambda () (interactive)))])
> >> 
> >> Results in the following warning being printed on the *Messages* buffer:
> >> 
> >>   Warning: (lambda nil \...) quoted with ' rather than with #'
> 
> Back in the 29.1 days, such embedded lambda were wrongly quoted by the
> code that turned the group specification into actual code.  As a result
> the lambda were not compiled and instead evaluated every time the lambda
> is called.  The lambda still worked correctly but was a teeny tiny bit
> less efficient.  Of course it is something that should be fixed (it is
> no just immeasurably slower, but wrong™), and by now that has happened.
> 
> The byte-compiler noticed the issue and warns about this harmless, but
> embarrassing issue.
> 
> >> Attempting to hashquote the lambda as in:
> >> 
> >>   (transient-define-prefix my-test-transient () ["Heading" ("a"
> >> "choice a" (lambda () (interactive)))])
> >> 
> >> ... as suggested by some on #emacs results in an error when
> >> evaluating.
> 
> Yes, that does not work here.  The evaluation rules are a bit different
> in these group specification vectors than elsewhere.  To an extend, I
> now regret having gone that way, but it is too late to change that now.
> 
> If I were to start over, I might require explicit unquoting:
> 
> (transient-define-prefix my-test-transient ()
>   `["Heading"
>     ("a" "choice a" ,(lambda () (interactive)))])
> 
> Alas, that is not how it works now.  This is a vector, so nothing in it
> has to be quoted.  (If you do quote something, as you have attempted,
> that doesn't work, because you end up with something that is quoted
> twice.)
> 
> The embedded lambda *should* be evaluated, so in more recent Transient
> versions, when the prefix is defined, we look for lambda in these
> vectors, and make special arrangements for those to be treated as code
> and not data.
> 
> Back in the 29.1 days that wasn't done yet, and that is what the warning
> is about.
> 
> >> At this point, I am not sure if this is an error in documentation of
> >> transient.el, or an error in the macro definition of the
> >> `transient-define-prefix' macro itself, or if the warning is
> >> superfluous and whether it should be ignored. As I'm unsure whether
> >> this is a bug or not, I'm erring on the side of safety and reporting
> >> it to bring it to attention.
> 
> It is harmless and can be ignored.
> 
> This bug report can be closed.

Thanks, done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 30 Mar 2025 11:24:35 GMT) Full text and rfc822 format available.

This bug report was last modified 97 days ago.

Previous Next


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