]> git.eshelyaron.com Git - emacs.git/commitdiff
Use characters for keys in project-switch-commands
authorSimen Heggestøyl <simenheg@gmail.com>
Thu, 4 Jun 2020 17:56:32 +0000 (19:56 +0200)
committerSimen Heggestøyl <simenheg@gmail.com>
Thu, 4 Jun 2020 18:14:02 +0000 (20:14 +0200)
* 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

index c5b6209d9b45dd3e293b245e2c813da2c231f941..ad0bb6763acaad7009917df21c4ac118ef5cf848 100644 (file)
@@ -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