From: Eli Zaretskii <eliz@gnu.org>
To: "João Távora" <joaotavora@gmail.com>, jonas@bernoul.li
Cc: 68568@debbugs.gnu.org
Subject: bug#68568: transient.el interns potentially enormous symbols as commands
Date: Sat, 27 Jan 2024 11:15:11 +0200 [thread overview]
Message-ID: <86v87f87ds.fsf@gnu.org> (raw)
In-Reply-To: <87r0ieeu84.fsf@gmail.com> (message from João Távora on Thu, 18 Jan 2024 11:50:19 +0000)
Ping!
Jonas, any comments or suggestions?
> From: João Távora <joaotavora@gmail.com>
> Date: Thu, 18 Jan 2024 11:50:19 +0000
>
> Hello,
>
> I'd never used a package that made use of "transient.el" before.
> I have now, via gptel.el Takes a bit of getting used to, but I like it
> (and can see why people like it in Magit).
>
> Now, immediately after using it, I start noticing that the completion
> that Fido mode offers on M-x starts to get weirdly contaminated by these
> symbols with enormous symbols names. This makes my Emacs almost
> unusable. I'd think other completion packages would be similarly
> affected unless they special case transient symols some how.
>
> Peeping into the transient source code, we can see that it uses a lot
> of 'eval' to define some commands just in time as a user navigates the
> menus and submenus.
>
> All these commands seem point to the same actual command, and do not
> seem to be meant to be called with M-x at all. They are generated at
> lazily at runtime and only for the submenus being visited.
>
> So they're just temporary artefacts of implementation. Who know if this
> is where the library gets its name. It's curious, but not going to
> argue much on this approach.
>
> Anyway, transient uses 'intern' when I think it could just use
> 'make-symbol' to avoid polluting the obarray and this whole problem. It
> seems to keep functioning and solves my problem. Here's the trivial
> patch. Would you look at it, Jonas?
>
> diff --git a/lisp/transient.el b/lisp/transient.el
> index f9060f5ba85..249c25262ea 100644
> --- a/lisp/transient.el
> +++ b/lisp/transient.el
> @@ -1127,7 +1127,7 @@ transient--parse-suffix
> ((and (commandp car)
> (not (stringp car)))
> (let ((cmd pop)
> - (sym (intern
> + (sym (make-symbol
> (format "transient:%s:%s"
> prefix
> (let ((desc (plist-get args :description)))
> @@ -1156,7 +1156,7 @@ transient--parse-suffix
> (when-let ((shortarg (transient--derive-shortarg arg)))
> (setq args (plist-put args :shortarg shortarg)))
> (setq args (plist-put args :argument arg))))
> - (setq sym (intern (format "transient:%s:%s" prefix arg)))
> + (setq sym (make-symbol (format "transient:%s:%s" prefix arg)))
> (setq args (plist-put
> args :command
> `(prog1 ',sym
>
>
>
> If some kind of persistent storage for these symbols IS needed I
> recommend a separate obarray. Also, why does the full and potentially
> very long description in plain text have to be a part of the symbol
> name? This doesn't matter with the 'make-symbol' approach, but I still
> find it curious.
>
> João
>
>
>
>
next prev parent reply other threads:[~2024-01-27 9:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 11:50 bug#68568: transient.el interns potentially enormous symbols as commands João Távora
2024-01-21 4:27 ` Psionic K
2024-01-21 7:15 ` João Távora
2024-01-21 7:29 ` Psionic K
2024-01-21 8:10 ` João Távora
2024-01-21 8:26 ` Psionic K
2024-01-21 8:33 ` João Távora
2024-01-27 9:15 ` Eli Zaretskii [this message]
2024-01-27 18:18 ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-01 10:24 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86v87f87ds.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=68568@debbugs.gnu.org \
--cc=joaotavora@gmail.com \
--cc=jonas@bernoul.li \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).