]> git.eshelyaron.com Git - emacs.git/commitdiff
Change the project-switch-project prompt to include the dir name
authorshipmints <shipmints@gmail.com>
Wed, 12 Feb 2025 22:29:37 +0000 (00:29 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 13 Feb 2025 11:52:58 +0000 (12:52 +0100)
* lisp/progmodes/project.el:
(project--switch-project-command): Add new argument DIR.
Change the prompt to "Command in `xxx': ..." (bug#76235).
(project-switch-project): Pass DIR to the above function.

(cherry picked from commit 86e17fbcbddb57b0653b7046202e54624c477836)

lisp/progmodes/project.el

index 12e934e0fa569acf893663e09aabd0bebfedb0b6..b7e1db820b506c3927a222db3d3e92606d5264e0 100644 (file)
@@ -2221,7 +2221,7 @@ Otherwise, use the face `help-key-binding' in the prompt."
    project-switch-commands
    "  "))
 
-(defun project--switch-project-command ()
+(defun project--switch-project-command (&optional dir)
   (let* ((commands-menu
           (mapcar
            (lambda (row)
@@ -2251,7 +2251,14 @@ Otherwise, use the face `help-key-binding' in the prompt."
                                        (propertize "Unrecognized input"
                                                    'face 'warning)
                                        (help-key-description choice nil)))))
-        (setq choice (read-key-sequence (concat "Choose: " prompt)))
+        (setq choice (read-key-sequence (concat
+                                         (if dir
+                                             (format-message "Command in `%s': "
+                                                             (propertize
+                                                              dir 'face
+                                                              'font-lock-string-face))
+                                           "Command: ")
+                                         prompt)))
         (when (setq command (lookup-key commands-map choice))
           (when (numberp command) (setq command nil))
           (unless (or project-switch-use-entire-map
@@ -2276,7 +2283,7 @@ to directory DIR."
   (project--remember-dir dir)
   (let ((command (if (symbolp project-switch-commands)
                      project-switch-commands
-                   (project--switch-project-command)))
+                   (project--switch-project-command dir)))
         (buffer (current-buffer)))
     (unwind-protect
         (progn