GNU bug report logs - #76235
[PATCH] Improve prompt for 'project-switch-project'

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Wed, 12 Feb 2025 17:59:02 UTC

Severity: normal

Tags: patch

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 76235 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Wed, 12 Feb 2025 22:27:57 +0200
On 12/02/2025 22:13, Ship Mints wrote:
> Sounds good. I'll update the patch now maybe with "Command in" or 
> "Command for" after I see how it looks on the screen.

Thanks.

> Dealing with text stability in the little one-line minibuffer prompt is 
> indeed a challenge. Perhaps we can propertize the prefix to be bold or 
> the menu option list to be bolded so that at least it stands out?

Hm, I think bold might, conversely, call too much attention. It also 
depends on the individual system and font configuration.

Perhaps orthogonally, we could use the string face for the directory 
name. It helps a little, it seems?

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ff707437e95..a429c1d2c42 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -2211,7 +2211,7 @@ project--menu-prompt
    project-switch-commands
    "  "))

-(defun project--switch-project-command ()
+(defun project--switch-project-command (&optional dir)
   (let* ((commands-menu
           (mapcar
            (lambda (row)
@@ -2241,7 +2241,14 @@ project--switch-project-command
                                        (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
@@ -2266,7 +2273,7 @@ project-switch-project
   (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





This bug report was last modified 88 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.