GNU bug report logs -
#76235
[PATCH] Improve prompt for 'project-switch-project'
Previous Next
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
Message #8 received at 76235 <at> debbugs.gnu.org (full text, mbox):
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 ...: ".
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.