bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63648: 29.0.90; project.el: with switch-use-entire-map, switch-proje


From: Dmitry Gutov
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]