GNU bug report logs -
#41890
28.0.50; [PATCH]: Add bindings for project.el
Previous Next
Reported by: Theodor Thornhill <theo <at> thornhill.no>
Date: Tue, 16 Jun 2020 09:51:02 UTC
Severity: normal
Tags: patch
Found in version 28.0.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> linkov.net> writes:
> I think your choice of keys is better than in project-switch-commands.
> Maybe these keys should be copied to project-switch-commands, so it will to be
> in sync with project-prefix-map?
>
> Or is it possible to use project-prefix-map directly in project-switch-commands?
> For example, by using set-transient-map?
I tried implementig it, and it seems to work. The patch below isn't a
full commit, since I changed the structure of project-switch-commands
(it's now mapping command to description), but didn't update the
docstring.
--
Philip K.
[Message part 2 (text/x-diff, inline)]
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index c5301dccd3..6cb9811d3d 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -860,12 +879,12 @@ project-prompt-project-dir
;;;###autoload
(defvar project-switch-commands
- '((?f "Find file" project-find-file)
- (?r "Find regexp" project-find-regexp)
- (?d "Dired" project-dired)
- (?v "VC-Dir" project-vc-dir)
- (?s "Shell" project-shell)
- (?e "Eshell" project-eshell))
+ '((project-find-file "Find file")
+ (project-find-regexp "Find regexp")
+ (project-dired "Dired")
+ (project-vc-dir "VC-Dir")
+ (project-shell "Shell")
+ (project-eshell "Eshell"))
"Alist mapping keys to project switching menu entries.
Used by `project-switch-project' to construct a dispatch menu of
commands available upon \"switching\" to another project.
@@ -877,9 +896,10 @@ project-switch-commands
(defun project--keymap-prompt ()
"Return a prompt for the project swithing dispatch menu."
(mapconcat
- (pcase-lambda (`(,key ,label))
+ (pcase-lambda (`(,cmd ,label))
(format "[%s] %s"
- (propertize (key-description `(,key)) 'face 'bold)
+ (propertize (key-description (where-is-internal cmd project-prefix-map t))
+ 'face 'bold)
label))
project-switch-commands
" "))
@@ -890,14 +910,10 @@ project-switch-project
The available commands are picked from `project-switch-commands'
and presented in a dispatch menu."
(interactive)
- (let ((dir (project-prompt-project-dir))
- (choice nil))
- (while (not choice)
- (setq choice (assq (read-event (project--keymap-prompt))
- project-switch-commands)))
- (let ((default-directory dir)
- (project-current-inhibit-prompt t))
- (call-interactively (nth 2 choice)))))
+ (let ((default-directory (project-prompt-project-dir))
+ (project-current-inhibit-prompt t))
+ (message "%s" (project--keymap-prompt))
+ (set-transient-map project-prefix-map)))
(provide 'project)
;;; project.el ends here
This bug report was last modified 4 years and 357 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.