From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#68568: transient.el interns potentially enormous symbols as commands Date: Sat, 27 Jan 2024 11:15:11 +0200 Message-ID: <86v87f87ds.fsf@gnu.org> References: <87r0ieeu84.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20406"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68568@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , jonas@bernoul.li Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 27 10:16:06 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rTenG-00054X-Bn for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jan 2024 10:16:06 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTen7-0002sd-8T; Sat, 27 Jan 2024 04:15:57 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTen5-0002rc-3N for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 04:15:55 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTen4-0001UH-RM for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 04:15:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTenB-0006I3-Pu for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 04:16:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Jan 2024 09:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68568 X-GNU-PR-Package: emacs Original-Received: via spool by 68568-submit@debbugs.gnu.org id=B68568.170634693024121 (code B ref 68568); Sat, 27 Jan 2024 09:16:01 +0000 Original-Received: (at 68568) by debbugs.gnu.org; 27 Jan 2024 09:15:30 +0000 Original-Received: from localhost ([127.0.0.1]:53464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTemf-0006Gz-EP for submit@debbugs.gnu.org; Sat, 27 Jan 2024 04:15:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTemd-0006Gl-Nn for 68568@debbugs.gnu.org; Sat, 27 Jan 2024 04:15:28 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTemP-0001Ka-L9; Sat, 27 Jan 2024 04:15:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=NBSsreI29jpLRvCNrmzsB46+GQLx76vjMAvJ0W2hHe8=; b=UPh6k1FFijC6RAnL+tct Ug2bpep2eD6+m4YuTF6pXGW+13BNSrp9TzChFvFOWesANs2wCFqP+Vps8jNBowMg3dVb3xdyMH4ml ldvVnk/wazbzRA4WoAfou6Ju3EDVvRDyZ45Yzib+BrYsO1w2t51id6jevZFsWreliBh38oqz6WdOz YnLCnc35OsudmgXb0hLMqG7+MNFpfU7yAPMUsOCDy/rJojVtVxpUBRWkVeaW/oCkIlQPns4Q43Bis xxSKFBjH+w2Rbj+r/1XMz9Ze+9rODgYeUxkXgF5xTZmTKAD8WNJRFfkiEhxbbt18/E7UkJtPwZwwx VclPqoTjxjCoWQ==; In-Reply-To: <87r0ieeu84.fsf@gmail.com> (message from =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= on Thu, 18 Jan 2024 11:50:19 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:278978 Archived-At: Ping! Jonas, any comments or suggestions? > From: João Távora > 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 > > > >