From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Bernoulli via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68568: transient.el interns potentially enormous symbols as commands Date: Sat, 27 Jan 2024 19:18:22 +0100 Message-ID: <87mssqr66p.fsf@bernoul.li> References: <87r0ieeu84.fsf@gmail.com> <86v87f87ds.fsf@gnu.org> Reply-To: Jonas Bernoulli Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9265"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68568@debbugs.gnu.org To: Eli Zaretskii , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 27 19:19:18 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 1rTnGw-00029h-Po for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jan 2024 19:19:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTnGa-0004vH-LW; Sat, 27 Jan 2024 13:18:56 -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 1rTnGZ-0004tk-1Z for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 13:18: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 1rTnGY-0005HU-PU for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 13:18:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTnGf-0008WR-KD for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 13:19:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jonas Bernoulli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Jan 2024 18:19: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.170637952332734 (code B ref 68568); Sat, 27 Jan 2024 18:19:01 +0000 Original-Received: (at 68568) by debbugs.gnu.org; 27 Jan 2024 18:18:43 +0000 Original-Received: from localhost ([127.0.0.1]:55869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTnGM-0008Vt-VE for submit@debbugs.gnu.org; Sat, 27 Jan 2024 13:18:43 -0500 Original-Received: from mail.hostpark.net ([212.243.197.30]:53700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTnGJ-0008Vd-Oo for 68568@debbugs.gnu.org; Sat, 27 Jan 2024 13:18:41 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 81866162AB; Sat, 27 Jan 2024 19:18:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from; s=sel2011a; t=1706379506; bh=WTPtcGWMrbmQca+h7Quk9kLLxp/05RLV7LsckH3/TKY=; b= qXo/8jHLEjYVKyFjj3qjlFFpZfHBKq6HOnC1UArrkQ0LJoTPXgQYMbC12m5i1LbK IhQQCkTm3fHbcetFh/XbnUWn+U4ac48VgKnwT57+4Yz9vE/8INg43CIo655kVSPa JA06jBq7HXZmILO0WS7VKzuAAMfmjXbyaygr+CZfFsg= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id XKC8d21_6WqA; Sat, 27 Jan 2024 19:18:26 +0100 (CET) Original-Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 0B0D216255; Sat, 27 Jan 2024 19:18:24 +0100 (CET) In-Reply-To: <86v87f87ds.fsf@gnu.org> 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:279024 Archived-At: Eli Zaretskii writes: > Ping! > > Jonas, any comments or suggestions? We discussed at https://github.com/magit/transient/pull/273. Summary: It would probably be possible to avoid interning these symbols. I did some experimentation to come to that provisional assessment. But Transient has been using interned from the beginning, and as a result, many parts of Transient assume that interned symbols are being used. Using symbols made this aspect of Transient much simpler. This allowed me to focus on gradually improve other aspects, which are more complicated by necessity. If I had not used symbols, this would have slowed down development. Switching to not using symbols for some commands, would mean many things would have to be adjusted to handle both cases. This would undoubtedly lead to bugs and slow down development. I would rather work on the parts of Transient that IMO need improvement. IMO using commands that are fbound to interned symbols has one and only one drawback: they are offered as completion candidates by execute-extended-command. I have addressed this by setting read-extended-command-predicate to a function that hides "transient" commands that should be hidden and nothing else. The option is only set if, and only if, it is not already set to something other than nil. If the user customizes the option and pick one of the predicates offered by Emacs, then that predicate also hides Transient's "anonymous" commands. [There was a bug, I just fixed that.] IMO the result of this approach is that the only drawback of interning the symbols is gone; without me having to trade in that one drawback for many avoidable complications, as I would have to if I followed the request to not "needlessly" intern the "anonymous" symbols. An additional benefit of using read-extended-command-predicate is that it allows all of Transient's commands that should be hidden, to be hidden. Even if I did stop using interned symbols for the "anonymous" commands, which are inline when a transient menu is defined, there would still be other commands that are defined non-anonymously, but never the less should be hidden. (E.g., commands that toggle arguments and are defined using transient-define-infix, because they are useful in more than one menu, and are then referenced by name in the definitions of these menus.) Therefore, the addition to read-extended-command-predicate is necessary, whether I avoid interning the "anonymous" commands or not. And as a consequence of that, there would be zero benefit to avoiding to intern the "anonymous" commands; but many drawbacks. I have therefore decided to stick to using interned symbols. Even if you don't agree with me by now, there is one big drawback that moving away from interned symbols would have, which I believe will win you over. Each command is associated with an object and the symbol is used to link the two. As a consequence all "anonymous" commands that set an argument can be mere aliases to the same command, which only has to live in memory once. If the symbol can no longer be used to link the command and object, then the anonymous commands would have to be defined as oclosures. These closures would be nearly identical, but each one of them would permanently use up memory. -- Jonas