GNU bug report logs -
#60379
[PATCH] Eglot: don't use "nil" as minibuffer initial input
Previous Next
Reported by: Eshel Yaron <me <at> eshelyaron.com>
Date: Wed, 28 Dec 2022 12:23:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
>> Date: Wed, 28 Dec 2022 14:22:17 +0200
>> From: Eshel Yaron via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> Currently, doing emacs -Q and followed by M-x eglot in the scratch
>> buffer results in a prompt for major mode to manage with LSP, but the
>> initial minibuffer input as well as the default value for the
>> completing-read call are both set to the string "nil", which is not very
>> helpful as that's not a valid input.
>>
>> This patch tweaks the prompt a little and avoids this issue by leaving
>> the minibuffer's initial input empty and making sure we don't set the
>> default value to "nil" either.
>
> João, are you looking into this? WDYT?
No, I wasn't until now.
The idea looks sane, but I think 'format-prompt' can't be used if Eglot
is to continue supporting Emacs 26 and 27. Also I'd prefer if the patch
is slightly less disruptive to whitespace, like this:
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 15cb1b6fad..eb3b51ed8b 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -991,6 +991,7 @@ eglot--guess-contact
non-nil, maybe prompt user, else error as soon as something can't
be guessed."
(let* ((guessed-mode (if buffer-file-name major-mode))
+ (guessed-mode-name (and guessed-mode (symbol-name guessed-mode)))
(main-mode
(cond
((and interactive
@@ -1000,7 +1001,7 @@ eglot--guess-contact
(completing-read
"[eglot] Start a server to manage buffers of what major mode? "
(mapcar #'symbol-name (eglot--all-major-modes)) nil t
- (symbol-name guessed-mode) nil (symbol-name guessed-mode) nil)))
+ guessed-mode-name nil guessed-mode-name nil)))
((not guessed-mode)
(eglot--error "Can't guess mode to manage for `%s'" (current-buffer)))
(t guessed-mode)))
Other than that, it's fine to commit.
João
This bug report was last modified 2 years and 188 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.