From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#68568: transient.el interns potentially enormous symbols as commands Date: Thu, 18 Jan 2024 11:50:19 +0000 Message-ID: <87r0ieeu84.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26544"; mail-complaints-to="usenet@ciao.gmane.io" To: 68568@debbugs.gnu.org, jonas@bernoul.li Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 18 12:51:15 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 1rQQvS-0006k4-TL for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Jan 2024 12:51:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQQvH-0005Mb-SO; Thu, 18 Jan 2024 06:51:03 -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 1rQQvE-0004yN-OS for bug-gnu-emacs@gnu.org; Thu, 18 Jan 2024 06:51:00 -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 1rQQvE-0007eT-9K for bug-gnu-emacs@gnu.org; Thu, 18 Jan 2024 06:51:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQQvF-0006pA-PH for bug-gnu-emacs@gnu.org; Thu, 18 Jan 2024 06:51:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Jan 2024 11:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68568 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org, Jonas Bernoulli Original-Received: via spool by submit@debbugs.gnu.org id=B.170557863926200 (code B ref -1); Thu, 18 Jan 2024 11:51:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jan 2024 11:50:39 +0000 Original-Received: from localhost ([127.0.0.1]:54489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQQus-0006oW-PR for submit@debbugs.gnu.org; Thu, 18 Jan 2024 06:50:39 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:43568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQQuq-0006oI-QR for submit@debbugs.gnu.org; Thu, 18 Jan 2024 06:50:37 -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 1rQQuh-000302-U0 for bug-gnu-emacs@gnu.org; Thu, 18 Jan 2024 06:50:28 -0500 Original-Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQQue-0006ij-5f for bug-gnu-emacs@gnu.org; Thu, 18 Jan 2024 06:50:27 -0500 Original-Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40e7e2e04f0so36343745e9.1 for ; Thu, 18 Jan 2024 03:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705578620; x=1706183420; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=TT8B81mnV9s8hx0xXzsjDh0SGHT27cG1N2sjoHu0KEY=; b=g5HF2I2a0Iyw2RbBGZ5X65w2xdA7CstoV98GgYKsfhq2lkhN6fJRpRI/oRI70rMOva 3D4CX+ELWKiKrul7jEM5GV7vXW8KzF4Mq2orN/VxF/orVgpXrMWgJDblfrhiUHOhzIKZ BzBhL249ZZ/tnPeLYr+Vm2NmSgg+rz9uCmcqO41Wol7kQnMY28Ao3C7ku17hifKlI0kc y384WhUtYjIrLjAujrkG5qjMhneBD5vYcRTriSL6yAj6KNukutEYn7WFFVTyASxTiLiJ uSbPGpp9ok9JYX0v4cbaSoS8oEl/q1MntbqTA1ycGvlM3D+29GqSwQRIGoXRjdWNOsj4 Wl1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705578620; x=1706183420; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TT8B81mnV9s8hx0xXzsjDh0SGHT27cG1N2sjoHu0KEY=; b=w8USwmNYd2gBvZi9xAGWEhXFevLdFbnS+rL3Xg8KcGq8VVHYCsnidjfeiiRrFOBzTe dE7lEYXetV+kZoCyiDzCI4Xvh3M2WlE41UuDK6ZeFIP+aBT5NXeI49R2ed/pZJTHZMxM VpcJoc0TFOXQGQORZl8Eww5SdiETOE1W6LHtNdqTOygbcx0u9kWKAqpOJ71AbC9QKlkt KiGS4aTBuwGiSal2LgLYjuGQHb7PhulSUi5ewjaeG+JHcTT6M8LoQH/7JKDDBRPTSTSP LwJsZRHAEit4hJ8D7CWjEIv5UAf0jvfJUG8jsXxBnjr9kdv+2WNFfNFjNSbQTtDVF1be a3oQ== X-Gm-Message-State: AOJu0YxZoF+SIAVwLpsRJE3hqphWS6VO4KEybbQIdjXvcz+CPl++mCHC JGpcHwnQTFZppspsNApPRulb5tgFOXlLdgsqQiakGieaBDL9wxpgVv4VbDM6 X-Google-Smtp-Source: AGHT+IHdNoP/A8nB8My0q6/2Q8lO+zEnYNNW6DRRk3Yt1m49/YnoYWAoaEgFSkJr5R0Gdd7jKvVqRg== X-Received: by 2002:a05:600c:154c:b0:40e:52f4:81bb with SMTP id f12-20020a05600c154c00b0040e52f481bbmr401801wmg.146.1705578620112; Thu, 18 Jan 2024 03:50:20 -0800 (PST) Original-Received: from krug ([87.196.72.99]) by smtp.gmail.com with ESMTPSA id z10-20020a05600c0a0a00b0040e486bc0dfsm29777328wmp.27.2024.01.18.03.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 03:50:19 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=joaotavora@gmail.com; helo=mail-wm1-x330.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:278430 Archived-At: 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=C3=A3o