From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#63648: 29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands Date: Fri, 26 May 2023 11:16:46 -0400 Message-ID: References: <86wn10e1wl.fsf@mail.linkov.net> <864jo11yvp.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19912"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63648@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 26 17:17:15 2023 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 1q2ZBr-00052L-L7 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 May 2023 17:17:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2ZBi-0000Dn-6G; Fri, 26 May 2023 11:17:06 -0400 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 1q2ZBe-00009M-Od for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 11:17:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2ZBe-0000PT-FZ for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 11:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2ZBe-0004ZC-7J for bug-gnu-emacs@gnu.org; Fri, 26 May 2023 11:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 May 2023 15:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63648 X-GNU-PR-Package: emacs Original-Received: via spool by 63648-submit@debbugs.gnu.org id=B63648.168511421517535 (code B ref 63648); Fri, 26 May 2023 15:17:02 +0000 Original-Received: (at 63648) by debbugs.gnu.org; 26 May 2023 15:16:55 +0000 Original-Received: from localhost ([127.0.0.1]:50573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2ZBX-0004Yl-Dn for submit@debbugs.gnu.org; Fri, 26 May 2023 11:16:55 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:60035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2ZBV-0004YP-Ri for 63648@debbugs.gnu.org; Fri, 26 May 2023 11:16:54 -0400 In-Reply-To: <864jo11yvp.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 24 May 2023 19:24:10 +0300") 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:262439 Archived-At: Juri Linkov writes: >>>> (Tangential further thought: I wonder if we could make C-x p work as a >>>> prefix for all commands automatically, so for example C-x p C-x C-j >>>> would open the project root, C-x p M-& would run a shell command in the >>>> root, etc. That would be neat.) >>> >>> IOW, like 'C-x p p' but without asking for another project. Doable as well. >> >> I'm curious, how are you thinking this would be implemented? My thought >> was that C-x p would act as a prefix for any key sequence in this way, >> *but* also C-x p c and the other things currently in project-prefix-map >> would still be explicitly bound, so they can be looked up with >> describe-key. And also, C-x p C-h should still run >> describe-prefix-bindings. I don't know how one would achieve this... > > Probably this is not possible. What I meant is to bind 'C-x p' > to a special command that uses 'set-transient-map'. But then such > command could be bound to e.g. 'C-x p /' (with mnemonics "root") > to set 'default-directory' to the project root for the next command. Yes, that would make sense. It would be nice if that kind of approach didn't hurt the self-documentation capabilities of Emacs. I have an idea for how to make it work, which might be generally useful: Maybe commands/keybindings could support marking themselves as "prefix" commands, such that when you run describe-key and enter the prefix key sequence, describe-key accepts another key sequence after you finish the prefix key sequence, and interprets it with the altered keymaps that would be created by the prefix. And then the help buffer would print the help for both commands. So then (describe-key (kbd "C-x p M-&")) would print help for both the new project-prefix command and async-shell-command. And also, (describe-key (kbd "C-x p c")) would print help for both project-prefix and project-compile, the latter being bound only by the transient created by C-x p. And also, describe-prefix-bindings would be taught to describe any additional bindings added by an explicitly marked prefix command. So C-x p C-h would print all the same bindings as it currently does. This probably wouldn't be worth it just for project.el, but it could allow another very cool change: We could turn C-x 4, C-x 5, and C-x t into prefixes like this, which behave like C-x 4 4, C-x 5 5, and C-x t t do today, and turn their current bindings into a transient. If we added this explicit support for "prefix" commands, we could maybe do this without losing any features or self-documenting abilities. So then, e.g., C-x 4 M-& would run async-shell-command in another window. One less key to hit would make that a lot more convenient IMO... Probably we wouldn't want to do that by default, but it could be a nice user customization. I'd like to turn it on myself...