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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76235 in the body.
You can then email your comments to 76235 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Wed, 12 Feb 2025 17:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ship Mints <shipmints <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 12 Feb 2025 17:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Improve prompt for 'project-switch-project'
Date: Wed, 12 Feb 2025 12:57:47 -0500
[Message part 1 (text/plain, inline)]
Improved prompt for 'project-switch-project' now displays the chosen
project on which to invoke a command. The prompt now reads "Command for
project "xxx": " vs "Choose: " which never read well to me.

-Stephane
[Message part 2 (text/html, inline)]
[0001-Improve-prompt-for-project-switch-project.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Wed, 12 Feb 2025 20:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>, 76235 <at> debbugs.gnu.org
Cc: Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Wed, 12 Feb 2025 22:10:08 +0200
Hi!

On 12/02/2025 19:57, Ship Mints wrote:
> Improved prompt for 'project-switch-project' now displays the chosen 
> project on which to invoke a command. The prompt now reads "Command for 
> project "xxx": " vs "Choose: " which never read well to me.

Thanks for the suggestion - I see the problem it aims to address.

One minor problem is that the "menu" becomes less stable horizontally, 
moving right or left depending on the directory name's length.

Not sure if an ideal solution is possible, but here's a tweak with a 
shorter prompt. WDYT?

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ff707437e95..e6280cd0883 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,11 @@ 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': " dir)
+                                           "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 +2270,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


Or "Call in ...: ", or "Invoke in ...: ", or just "In ...: ".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Wed, 12 Feb 2025 20:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Wed, 12 Feb 2025 15:13:56 -0500
[Message part 1 (text/plain, inline)]
Sounds good. I'll update the patch now maybe with "Command in" or "Command
for" after I see how it looks on the screen.

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?

On Wed, Feb 12, 2025 at 3:10 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> Hi!
>
> On 12/02/2025 19:57, Ship Mints wrote:
> > Improved prompt for 'project-switch-project' now displays the chosen
> > project on which to invoke a command. The prompt now reads "Command for
> > project "xxx": " vs "Choose: " which never read well to me.
>
> Thanks for the suggestion - I see the problem it aims to address.
>
> One minor problem is that the "menu" becomes less stable horizontally,
> moving right or left depending on the directory name's length.
>
> Not sure if an ideal solution is possible, but here's a tweak with a
> shorter prompt. WDYT?
>
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index ff707437e95..e6280cd0883 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,11 @@ 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': " dir)
> +                                           "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 +2270,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
>
>
> Or "Call in ...: ", or "Invoke in ...: ", or just "In ...: ".
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Wed, 12 Feb 2025 20:29:03 GMT) Full text and rfc822 format available.

Message #14 received at 76235 <at> debbugs.gnu.org (full text, mbox):

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: Re: 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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Wed, 12 Feb 2025 20:35:01 GMT) Full text and rfc822 format available.

Message #17 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Wed, 12 Feb 2025 15:34:08 -0500
[Message part 1 (text/plain, inline)]
That looks nice. Revised patch attached.

On Wed, Feb 12, 2025 at 3:28 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> 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
>
>
[Message part 2 (text/html, inline)]
[0001-Improve-prompt-for-project-switch-project.patch (application/octet-stream, attachment)]

Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Wed, 12 Feb 2025 22:38:02 GMT) Full text and rfc822 format available.

Notification sent to Ship Mints <shipmints <at> gmail.com>:
bug acknowledged by developer. (Wed, 12 Feb 2025 22:38:02 GMT) Full text and rfc822 format available.

Message #22 received at 76235-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 76235-done <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Thu, 13 Feb 2025 00:37:15 +0200
On 12/02/2025 22:34, Ship Mints wrote:
> That looks nice. Revised patch attached.

Thanks, pushed to master, 86e17fbcbddb, with minor touches (using 
'format-message', commit message changes).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Thu, 13 Feb 2025 07:12:02 GMT) Full text and rfc822 format available.

Message #25 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Thu, 13 Feb 2025 09:03:30 +0200
>> Improved prompt for 'project-switch-project' now displays the chosen 
>> project on which to invoke a command. The prompt now reads "Command for 
>> project "xxx": " vs "Choose: " which never read well to me.
>
> Thanks for the suggestion - I see the problem it aims to address.
>
> One minor problem is that the "menu" becomes less stable horizontally, 
> moving right or left depending on the directory name's length.
>
> Not sure if an ideal solution is possible, but here's a tweak with a 
> shorter prompt. WDYT?

Instead of project--switch-project-command, I'm using
project-prefix-or-any-command that already has
the project root in the prompt "[execute in %s]:".
So it's nice that project--switch-project-command
will have the same.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Fri, 14 Feb 2025 03:53:02 GMT) Full text and rfc822 format available.

Message #28 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Fri, 14 Feb 2025 05:52:41 +0200
On 13/02/2025 09:03, Juri Linkov wrote:
> Instead of project--switch-project-command, I'm using
> project-prefix-or-any-command that already has
> the project root in the prompt "[execute in %s]:".
> So it's nice that project--switch-project-command
> will have the same.

Hey, do you think it should look more similar to the new addition as 
well? Something like:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 35bf66c9ffb..bbc65ddafb6 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -2035,7 +2035,7 @@ project-any-command
          (prompt-format (or prompt-format "[execute in %s]:"))
          (command (let ((overriding-terminal-local-map overriding-map))
                     (key-binding (read-key-sequence
-                                  (format prompt-format (project-root pr)))
+                                  (format-message prompt-format 
(project-root pr)))
                                  t)))
          (root (project-root pr)))
     (when command
@@ -2053,7 +2053,11 @@ project-prefix-or-any-command
 Works like `project-any-command', but also mixes in the shorter
 bindings from `project-prefix-map'."
   (interactive)
-  (project-any-command project-prefix-map "[execute in %s]:"))
+  (project-any-command project-prefix-map
+                       (concat
+                        "Execute in `"
+                        (propertize "%s" 'face 'font-lock-string-face)
+                        "':")))

 (defun project-remember-projects-under (dir &optional recursive)
   "Remember projects below a directory DIR.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Fri, 14 Feb 2025 07:07:02 GMT) Full text and rfc822 format available.

Message #31 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Fri, 14 Feb 2025 09:04:35 +0200
>> Instead of project--switch-project-command, I'm using
>> project-prefix-or-any-command that already has
>> the project root in the prompt "[execute in %s]:".
>> So it's nice that project--switch-project-command
>> will have the same.
>
> Hey, do you think it should look more similar to the new addition as 
> well? Something like:
>
> -  (project-any-command project-prefix-map "[execute in %s]:"))
> +  (project-any-command project-prefix-map
> +                       (concat
> +                        "Execute in `"
> +                        (propertize "%s" 'face 'font-lock-string-face)
> +                        "':")))

I think square brackets [execute in %s] look better
and will be in line with square brackets in defcustom crm-prompt
when we will push the patch from bug#76028 when no more fixes
for completing-read-multiple are needed to avoid merge conflicts.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Fri, 14 Feb 2025 12:01:02 GMT) Full text and rfc822 format available.

Message #34 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 76235 <at> debbugs.gnu.org
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Fri, 14 Feb 2025 07:00:01 -0500
[Message part 1 (text/plain, inline)]
Square brackets are a good idea, and visually appealing, for these kinds of
context-hinted prompts.

On Fri, Feb 14, 2025 at 2:06 AM Juri Linkov <juri <at> linkov.net> wrote:

> >> Instead of project--switch-project-command, I'm using
> >> project-prefix-or-any-command that already has
> >> the project root in the prompt "[execute in %s]:".
> >> So it's nice that project--switch-project-command
> >> will have the same.
> >
> > Hey, do you think it should look more similar to the new addition as
> > well? Something like:
> >
> > -  (project-any-command project-prefix-map "[execute in %s]:"))
> > +  (project-any-command project-prefix-map
> > +                       (concat
> > +                        "Execute in `"
> > +                        (propertize "%s" 'face 'font-lock-string-face)
> > +                        "':")))
>
> I think square brackets [execute in %s] look better
> and will be in line with square brackets in defcustom crm-prompt
> when we will push the patch from bug#76028 when no more fixes
> for completing-read-multiple are needed to avoid merge conflicts.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Fri, 14 Feb 2025 20:43:01 GMT) Full text and rfc822 format available.

Message #37 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Fri, 14 Feb 2025 22:42:00 +0200
On 14/02/2025 09:04, Juri Linkov wrote:
>> Hey, do you think it should look more similar to the new addition as
>> well? Something like:
>>
>> -  (project-any-command project-prefix-map "[execute in %s]:"))
>> +  (project-any-command project-prefix-map
>> +                       (concat
>> +                        "Execute in `"
>> +                        (propertize "%s" 'face 'font-lock-string-face)
>> +                        "':")))
> I think square brackets [execute in %s] look better
> and will be in line with square brackets in defcustom crm-prompt
> when we will push the patch from bug#76028 when no more fixes
> for completing-read-multiple are needed to avoid merge conflicts.

Okay, if you are sure.

No curly quotes and no string face, then?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Fri, 14 Feb 2025 20:45:02 GMT) Full text and rfc822 format available.

Message #40 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Fri, 14 Feb 2025 15:44:22 -0500
[Message part 1 (text/plain, inline)]
See how brackets look with and without the face? I trust your taste.

On Fri, Feb 14, 2025 at 3:42 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> On 14/02/2025 09:04, Juri Linkov wrote:
> >> Hey, do you think it should look more similar to the new addition as
> >> well? Something like:
> >>
> >> -  (project-any-command project-prefix-map "[execute in %s]:"))
> >> +  (project-any-command project-prefix-map
> >> +                       (concat
> >> +                        "Execute in `"
> >> +                        (propertize "%s" 'face 'font-lock-string-face)
> >> +                        "':")))
> > I think square brackets [execute in %s] look better
> > and will be in line with square brackets in defcustom crm-prompt
> > when we will push the patch from bug#76028 when no more fixes
> > for completing-read-multiple are needed to avoid merge conflicts.
>
> Okay, if you are sure.
>
> No curly quotes and no string face, then?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Fri, 14 Feb 2025 21:25:01 GMT) Full text and rfc822 format available.

Message #43 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>, Juri Linkov <juri <at> linkov.net>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Fri, 14 Feb 2025 15:24:12 -0600
Dmitry Gutov <dmitry <at> gutov.dev> writes:

> Hey, do you think it should look more similar to the new addition as
> well? Something like:
>
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index 35bf66c9ffb..bbc65ddafb6 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -2035,7 +2035,7 @@ project-any-command
>            (prompt-format (or prompt-format "[execute in %s]:"))
>            (command (let ((overriding-terminal-local-map overriding-map))
>                       (key-binding (read-key-sequence
> -                                  (format prompt-format (project-root pr)))
> +                                  (format-message prompt-format
> (project-root pr)))
>                                    t)))
>            (root (project-root pr)))
>       (when command
> @@ -2053,7 +2053,11 @@ project-prefix-or-any-command
>   Works like `project-any-command', but also mixes in the shorter
>   bindings from `project-prefix-map'."
>     (interactive)
> -  (project-any-command project-prefix-map "[execute in %s]:"))
> +  (project-any-command project-prefix-map
> +                       (concat
> +                        "Execute in `"
> +                        (propertize "%s" 'face 'font-lock-string-face)
> +                        "':")))
>
>   (defun project-remember-projects-under (dir &optional recursive)
>     "Remember projects below a directory DIR.

FWIW, I actually don't mind that they're different, because one is
asking for "any command" instead of just some predefined (and displayed)
keys.

I do find the current message unclear, so I'd suggest something like

    [run command in %s]

where %s has the string face, the colon is removed (because this is not
a prompt per se), and "execute" is changed to "run" (which AFAICT is the
most commonly used terminology in Emacs, though there are exceptions).

Anyways, it's your call what to do here, but those are my two cents.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Sat, 15 Feb 2025 18:22:02 GMT) Full text and rfc822 format available.

Message #46 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Sat, 15 Feb 2025 20:17:21 +0200
>>> -  (project-any-command project-prefix-map "[execute in %s]:"))
>>> +  (project-any-command project-prefix-map
>>> +                       (concat
>>> +                        "Execute in `"
>>> +                        (propertize "%s" 'face 'font-lock-string-face)
>>> +                        "':")))
>> I think square brackets [execute in %s] look better
>> and will be in line with square brackets in defcustom crm-prompt
>> when we will push the patch from bug#76028 when no more fixes
>> for completing-read-multiple are needed to avoid merge conflicts.
>
> Okay, if you are sure.
>
> No curly quotes and no string face, then?

Maybe better to make the prompt configurable
(not defcustom, but only a variable,
so it's easy to apply properties with face).
Then I'd like to change it to just "[%s]" to save space.
A longer explanatory text is more suitable for everyone
who use the command infrequently.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Mon, 17 Feb 2025 03:16:01 GMT) Full text and rfc822 format available.

Message #49 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Stefan Kangas <stefankangas <at> gmail.com>, Juri Linkov <juri <at> linkov.net>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Mon, 17 Feb 2025 05:14:51 +0200
On 14/02/2025 23:24, Stefan Kangas wrote:
> I do find the current message unclear, so I'd suggest something like
> 
>      [run command in %s]
> 
> where %s has the string face, the colon is removed (because this is not
> a prompt per se), and "execute" is changed to "run" (which AFAICT is the
> most commonly used terminology in Emacs, though there are exceptions).

Hmm, when we look at how it gets displayed in practice, we show the 
prompt, and then either nothing, or the current prefix key sequence 
(after a timeout, the echo-keystrokes thing) - which might imply that 
the verb we use relates to the key sequence rather than the command 
invoked. And we "call" both commands and macros.

I might be overthinking this.

> Anyways, it's your call what to do here, but those are my two cents.

No strong preference for me, and it's good to hear what others feel is 
acceptable.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Mon, 17 Feb 2025 03:17:02 GMT) Full text and rfc822 format available.

Message #52 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Mon, 17 Feb 2025 05:16:33 +0200
On 15/02/2025 20:17, Juri Linkov wrote:
> Maybe better to make the prompt configurable
> (not defcustom, but only a variable,
> so it's easy to apply properties with face).
> Then I'd like to change it to just "[%s]" to save space.
> A longer explanatory text is more suitable for everyone
> who use the command infrequently.

Could we reuse that variable in both commands?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Mon, 17 Feb 2025 07:36:01 GMT) Full text and rfc822 format available.

Message #55 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Mon, 17 Feb 2025 09:35:06 +0200
>> Maybe better to make the prompt configurable
>> (not defcustom, but only a variable,
>> so it's easy to apply properties with face).
>> Then I'd like to change it to just "[%s]" to save space.
>> A longer explanatory text is more suitable for everyone
>> who use the command infrequently.
>
> Could we reuse that variable in both commands?

Sharing the same variable would be nice.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Mon, 17 Feb 2025 08:48:01 GMT) Full text and rfc822 format available.

Message #58 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Mon, 17 Feb 2025 03:47:04 -0500
[Message part 1 (text/plain, inline)]
Perhaps "invoke" instead of "execute" which sounds more natural for
commands, functions, keys sequences?

On Sun, Feb 16, 2025 at 10:14 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> On 14/02/2025 23:24, Stefan Kangas wrote:
> > I do find the current message unclear, so I'd suggest something like
> >
> >      [run command in %s]
> >
> > where %s has the string face, the colon is removed (because this is not
> > a prompt per se), and "execute" is changed to "run" (which AFAICT is the
> > most commonly used terminology in Emacs, though there are exceptions).
>
> Hmm, when we look at how it gets displayed in practice, we show the
> prompt, and then either nothing, or the current prefix key sequence
> (after a timeout, the echo-keystrokes thing) - which might imply that
> the verb we use relates to the key sequence rather than the command
> invoked. And we "call" both commands and macros.
>
> I might be overthinking this.
>
> > Anyways, it's your call what to do here, but those are my two cents.
>
> No strong preference for me, and it's good to hear what others feel is
> acceptable.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Tue, 18 Feb 2025 02:39:02 GMT) Full text and rfc822 format available.

Message #61 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Tue, 18 Feb 2025 04:38:08 +0200
[Message part 1 (text/plain, inline)]
On 17/02/2025 09:35, Juri Linkov wrote:
>>> Maybe better to make the prompt configurable
>>> (not defcustom, but only a variable,
>>> so it's easy to apply properties with face).
>>> Then I'd like to change it to just "[%s]" to save space.
>>> A longer explanatory text is more suitable for everyone
>>> who use the command infrequently.
>> Could we reuse that variable in both commands?
> Sharing the same variable would be nice.

Like this?
[project-command-prompt.diff (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Tue, 18 Feb 2025 02:50:02 GMT) Full text and rfc822 format available.

Message #64 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 76235 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Tue, 18 Feb 2025 04:49:00 +0200
On 17/02/2025 10:47, Ship Mints wrote:
> Perhaps "invoke" instead of "execute" which sounds more natural for 
> commands, functions, keys sequences?

Logically it makes sense, but could this term be too specialized?

Having tried it in a prompt, it doesn't seem obvious enough. But then 
again, maybe it's just a matter of getting used. I don't have a strong 
opinion.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Tue, 18 Feb 2025 12:23:02 GMT) Full text and rfc822 format available.

Message #67 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Tue, 18 Feb 2025 07:22:00 -0500
[Message part 1 (text/plain, inline)]
Maybe "Command for:" vs "Command in:" since the context project and not a
directory--directory is an implementation detail, and
project-external-roots make the concept of a single directory ambiguous? Go
for it. We can always change it later.

On Mon, Feb 17, 2025 at 9:49 PM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> On 17/02/2025 10:47, Ship Mints wrote:
> > Perhaps "invoke" instead of "execute" which sounds more natural for
> > commands, functions, keys sequences?
>
> Logically it makes sense, but could this term be too specialized?
>
> Having tried it in a prompt, it doesn't seem obvious enough. But then
> again, maybe it's just a matter of getting used. I don't have a strong
> opinion.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Tue, 18 Feb 2025 17:15:02 GMT) Full text and rfc822 format available.

Message #70 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Tue, 18 Feb 2025 19:13:36 +0200
>>>> Maybe better to make the prompt configurable
>>>> (not defcustom, but only a variable,
>>>> so it's easy to apply properties with face).
>>>> Then I'd like to change it to just "[%s]" to save space.
>>>> A longer explanatory text is more suitable for everyone
>>>> who use the command infrequently.
>>> Could we reuse that variable in both commands?
>> Sharing the same variable would be nice.
>
> Like this?

Whatever, then I'd change it anyway to something with
square brackets since with brackets it looked better for e.g.
'C-x 4 p p' with [other-window] prefix in brackets too:

  [execute in ...]:[other-window]-

(And 'completing-read-multiple' now uses brackets too.)

> +(defvar project-command-prompt (concat
> +                                "Command in `"
> +                                (propertize "%s" 'face 'font-lock-string-face)
> +                                "': ")
> +  "Prompt format to use for choosing a command by key or key sequence.")
> @@ -2032,7 +2038,7 @@ project-any-command
> -         (prompt-format (or prompt-format "[execute in %s]:"))
> +         (prompt-format (or prompt-format project-command-prompt))
> @@ -2247,10 +2253,8 @@ project--switch-project-command
> -                                             (format-message "Command in `%s': "
> -                                                             (propertize
> -                                                              dir 'face
> -                                                              'font-lock-string-face))
> +                                             (format-message project-command-prompt
> +                                                             dir)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Tue, 18 Feb 2025 21:07:02 GMT) Full text and rfc822 format available.

Message #73 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Juri Linkov <juri <at> linkov.net>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Tue, 18 Feb 2025 23:06:24 +0200
On 18/02/2025 19:13, Juri Linkov wrote:
>>>>> Maybe better to make the prompt configurable
>>>>> (not defcustom, but only a variable,
>>>>> so it's easy to apply properties with face).
>>>>> Then I'd like to change it to just "[%s]" to save space.
>>>>> A longer explanatory text is more suitable for everyone
>>>>> who use the command infrequently.
>>>> Could we reuse that variable in both commands?
>>> Sharing the same variable would be nice.
>>
>> Like this?
> 
> Whatever, then I'd change it anyway to something with
> square brackets since with brackets it looked better for e.g.
> 'C-x 4 p p' with [other-window] prefix in brackets too:
> 
>    [execute in ...]:[other-window]-
> 
> (And 'completing-read-multiple' now uses brackets too.)

completing-read-multiple uses brackets for a side note - which does not 
replace the prompt.

The example above also uses brackets for the name of an input event.

Using them to surround the prompt in project-other-project is a third, 
different purpose. Seems superfluous: the colon already separates the 
prompt.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Tue, 18 Feb 2025 21:18:02 GMT) Full text and rfc822 format available.

Message #76 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Ship Mints <shipmints <at> gmail.com>
Cc: 76235 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>,
 Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Tue, 18 Feb 2025 23:17:17 +0200
On 18/02/2025 14:22, Ship Mints wrote:
> Maybe "Command for:" vs "Command in:" since the context project and not 
> a directory--directory is an implementation detail, and project- 
> external-roots make the concept of a single directory ambiguous? Go for 
> it. We can always change it later.

In my POV the directory name is a stand-in for the project as a whole.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76235; Package emacs. (Wed, 19 Feb 2025 07:44:01 GMT) Full text and rfc822 format available.

Message #79 received at 76235 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 76235 <at> debbugs.gnu.org, Ship Mints <shipmints <at> gmail.com>
Subject: Re: bug#76235: [PATCH] Improve prompt for 'project-switch-project'
Date: Wed, 19 Feb 2025 09:37:27 +0200
>>>>>> Maybe better to make the prompt configurable
>>>>>> (not defcustom, but only a variable,
>>>>>> so it's easy to apply properties with face).
>>>>>> Then I'd like to change it to just "[%s]" to save space.
>>>>>> A longer explanatory text is more suitable for everyone
>>>>>> who use the command infrequently.
>>>>> Could we reuse that variable in both commands?
>>>> Sharing the same variable would be nice.
>>>
>>> Like this?
>> Whatever, then I'd change it anyway to something with
>> square brackets since with brackets it looked better for e.g.
>> 'C-x 4 p p' with [other-window] prefix in brackets too:
>>    [execute in ...]:[other-window]-
>> (And 'completing-read-multiple' now uses brackets too.)
>
> completing-read-multiple uses brackets for a side note - which does not
> replace the prompt.
>
> The example above also uses brackets for the name of an input event.
>
> Using them to surround the prompt in project-other-project is a third,
> different purpose. Seems superfluous: the colon already separates the
> prompt.

Then maybe need 2 format variables: for the name of an input event,
and for the prompt in project-other-project.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 19 Mar 2025 11:24:13 GMT) Full text and rfc822 format available.

This bug report was last modified 87 days ago.

Previous Next


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