[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e7fb0a4 2/3: Use characters for keys in project-switch-commands
From: |
Simen Heggestøyl |
Subject: |
master e7fb0a4 2/3: Use characters for keys in project-switch-commands |
Date: |
Thu, 4 Jun 2020 14:17:33 -0400 (EDT) |
branch: master
commit e7fb0a48a65c986e75d39848cac3c4d2435f4baa
Author: Simen Heggestøyl <simenheg@gmail.com>
Commit: Simen Heggestøyl <simenheg@gmail.com>
Use characters for keys in project-switch-commands
* lisp/progmodes/project.el (project-switch-commands): Use
characters for keys instead of string for better future
compatibility with 'read-multiple-choice'.
(project-switch-project): Adjust to above change.
---
lisp/progmodes/project.el | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index c5b6209..ad0bb67 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -824,12 +824,12 @@ It's also possible to enter an arbitrary directory."
;;;###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))
+ '((?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))
"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.
@@ -856,16 +856,12 @@ and presented in a dispatch menu."
(interactive)
(let ((dir (project-prompt-project-dir))
(choice nil))
- (while (not (and choice
- (or (equal choice (kbd "C-g"))
- (assoc choice project-switch-commands))))
- (setq choice (read-key-sequence (project--keymap-prompt))))
- (if (equal choice (kbd "C-g"))
- (message "Quit")
- (let ((default-directory dir)
- (project-current-inhibit-prompt t))
- (call-interactively
- (nth 2 (assoc choice project-switch-commands)))))))
+ (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)))))
(provide 'project)
;;; project.el ends here