From: Simen Heggestøyl Date: Thu, 4 Jun 2020 17:56:32 +0000 (+0200) Subject: Use characters for keys in project-switch-commands X-Git-Tag: emacs-28.0.90~7212 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e7fb0a48a65c986e75d39848cac3c4d2435f4baa;p=emacs.git 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. --- diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index c5b6209d9b4..ad0bb6763ac 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