From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov 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, 20 Oct 2023 01:39:14 +0300 Message-ID: <56e7d865-0456-db7d-3a5d-1235e62508bf@gutov.dev> References: <86h6of66o3.fsf@mail.linkov.net> <86wmxb2qvh.fsf@mail.linkov.net> <8634zyjt0k.fsf@mail.linkov.net> <8d1fb7ac-5c82-0ec2-8ae2-d09c131ec165@gutov.dev> <86edj6hyem.fsf@mail.linkov.net> <8634zitwoy.fsf@mail.linkov.net> <50d46d30-a796-b855-0d4c-690d6cb3d15b@gutov.dev> <86il88x9cy.fsf@mail.linkov.net> <4367c45c-95b3-6a29-4ba3-068a3c748452@gutov.dev> <2e34e515-a921-a969-0915-bea94c745f8b@gutov.dev> <868r9258oi.fsf@mail.linkov.net> <86edishisp.fsf@mail.linkov.net> <6fc81cbf-a21f-c5b4-aa56-e8518b8570d7@gutov.dev> <86msxgatuy.fsf@mail.linkov.net> <86y1gynr2u.fsf@mail.linkov.net> <7c72fd8c-c3f6-a974-8a4b-a081f7a9fe1a@gutov.dev> <86ttqmv7c6.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32530"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: Spencer Baugh , 63648@debbugs.gnu.org, sbaugh@catern.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 20 00:39:46 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 1qtbg9-0008HP-7b for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 20 Oct 2023 00:39:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtbg2-0000TU-0h; Thu, 19 Oct 2023 18:39:38 -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 1qtbfz-0000S0-NL for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 18:39:36 -0400 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 1qtbfz-00063g-F0 for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 18:39:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtbgQ-0007RE-8m for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 18:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Oct 2023 22:40: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.169775519528575 (code B ref 63648); Thu, 19 Oct 2023 22:40:02 +0000 Original-Received: (at 63648) by debbugs.gnu.org; 19 Oct 2023 22:39:55 +0000 Original-Received: from localhost ([127.0.0.1]:38066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtbgI-0007Qo-MH for submit@debbugs.gnu.org; Thu, 19 Oct 2023 18:39:55 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:57057) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtbgD-0007QY-W7 for 63648@debbugs.gnu.org; Thu, 19 Oct 2023 18:39:53 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CFA185C036E; Thu, 19 Oct 2023 18:39:17 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 19 Oct 2023 18:39:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1697755157; x=1697841557; bh=ixNVesNO13VlRSyr2WuSL4VjNSvdlcWZF1T SazJPIpw=; b=ueJCrUjZ3AKdMXt6+dchEXbAd/1iK3fNY76WOistQpQ71cPfM3G lWElOxDQwEFmpTpHso0HhEbPeDmj+OBgw2KiHRwCxJESoRMS8UZChHfH9aHBW52R /EzzhrSYXX/iXyqky30oL4MIBLW4f/dfqKR43FGk2Mzy/hZ5D1bi5x37toxoxKt/ KMT24qzaQy6x19JjF39MDGrXh0fB0UQ3+KI83rEZBzy9IC53kw9otgZHg1SIdlig LYrDzP6pOJDLaYmMHTS3VuZofHjfy4E72/fAe0t+yLaV2CkEDmazZf8WphA6fGaR sWBUp/ZxvrZJFSbuPt4jY0BT+3/Pqi9zGag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1697755157; x=1697841557; bh=ixNVesNO13VlRSyr2WuSL4VjNSvdlcWZF1T SazJPIpw=; b=RksaMHgLL/SrRxcavqE2ClV0lKTEazvYIezmMYtDHUWwZs6IgER Q2czigF+JxeWzAY2P5gUdmQjpbTB69zlyqiDQUKU8DXHWl8UwKGKTuAgvO2/iQah elVxaPPMSxpX91AbdfnnL73BvPeGfQcr+MKvO9IgVIPwkWIz6Y+42LglOjDj0NkS 79co3gIB3caWtnDZiYFzY0kVXviJMiinQsnqYICE4X5gEMm5xXLvOEgDA14LHt1P 7/LGCjzcQEvQ6gef8fQpYqHqNsm0r/GukJeG26trjkTYA1wMbZYYat1x9L/NRex4 N5avOSgWijkNEgYqL3DdoMuYm3pglVbFuSQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrjeejgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeeigfetveehveevffehledtueekieeikeeufeegudfgfeeghfdulefgfeevledv veenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Oct 2023 18:39:16 -0400 (EDT) Content-Language: en-US In-Reply-To: <86ttqmv7c6.fsf@mail.linkov.net> 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:272764 Archived-At: On 19/10/2023 20:56, Juri Linkov wrote: >> C-x p p C-x d - the key sequence is 'C-x p p o C-x d' > BTW, with (setq project-switch-use-entire-map t) > I accidentally typed 'C-x p p C-x d' that should ignore 'C-x' > and read a directory with 'd', it fails with: > > (wrong-type-argument commandp 1) Thanks, see the commit e1708697122 I just pushed. It should fix this, print the available keys from the whole keymap (when enabled), and echo mistakes as well. In a fairly bare way, but this should make the feature what I'd call usable. I also tried the variant with printing all the command names beside the keys, but even with ^project- stripped, they didn't fit on one line. 'C-x d' will result in a warning echo, though, instead of just using 'd'. If you really prefer that, try experimenting with the below addition, but I'm wary of edge cases, since we want to keep supporting sub-maps like in bug#47620. It also might feel a little too "magical" now that there are more details printed (it also doesn't handle extremes like 'C-c C-x C-c' still). diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 0d6539113cc..90b61609c45 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -2003,7 +2003,9 @@ project--switch-project-command (help-key-description choice nil))))) (setq choice (read-key-sequence (concat "Choose: " prompt))) (when (setq command (lookup-key commands-map choice)) - (when (numberp command) (setq command nil)) + (when (numberp command) + (setq command + (lookup-key commands-map (substring choice command)))) (unless (or project-switch-use-entire-map (assq command commands-menu)) ;; TODO: Add some hint to the prompt, like "key not