GNU bug report logs - #63648
29.0.90; project.el: with switch-use-entire-map, switch-project errors on non-project commands

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Mon, 22 May 2023 16:29:02 UTC

Severity: normal

Found in version 29.0.90

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: Spencer Baugh <sbaugh <at> janestreet.com>, 63648 <at> debbugs.gnu.org, sbaugh <at> catern.com
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
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





This bug report was last modified 1 year and 200 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.