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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60379 in the body.
You can then email your comments to 60379 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60379
; Package
emacs
.
(Wed, 28 Dec 2022 12:23:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eshel Yaron <me <at> eshelyaron.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 28 Dec 2022 12:23:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
Hello,
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.
Thanks,
Eshel
In GNU Emacs 30.0.50 (build 19, x86_64-apple-darwin22.1.0, NS
appkit-2299.00 Version 13.0 (Build 22A380)) of 2022-12-26 built on
esmac
Repository revision: cc29fab3a66c59e77d0ff67c0f3e2e34ec80a03c
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2299
System Description: macOS 13.0
Configured using:
'configure --with-native-compilation --enable-link-time-optimization
--with-json --with-xwidgets --with-mailutils --with-imagemagick
--without-dbus'
[0001-Eglot-don-t-use-nil-as-minibuffer-initial-input.patch (text/patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60379
; Package
emacs
.
(Thu, 12 Jan 2023 09:32:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 60379 <at> debbugs.gnu.org (full text, mbox):
> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60379
; Package
emacs
.
(Thu, 12 Jan 2023 10:20:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 60379 <at> debbugs.gnu.org (full text, mbox):
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
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sat, 14 Jan 2023 08:17:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Eshel Yaron <me <at> eshelyaron.com>
:
bug acknowledged by developer.
(Sat, 14 Jan 2023 08:17:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 60379-done <at> debbugs.gnu.org (full text, mbox):
> From: João Távora <joaotavora <at> gmail.com>
> Cc: Eshel Yaron <me <at> eshelyaron.com>, 60379 <at> debbugs.gnu.org
> Date: Thu, 12 Jan 2023 10:20:27 +0000
>
> 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.
OK, done, and closing the bug.
Yaron, this change was small enough to accept without copyright
assignment, but if you intend to continue contributing to Emacs (and
we hope you do), I recommend to start your copyright assignment
paperwork rolling at this time. If you agree, I will send you the
form to fill and the instructions to email it.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60379
; Package
emacs
.
(Sat, 14 Jan 2023 09:34:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 60379-done <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: João Távora <joaotavora <at> gmail.com>
>> Cc: Eshel Yaron <me <at> eshelyaron.com>, 60379 <at> debbugs.gnu.org
>> Date: Thu, 12 Jan 2023 10:20:27 +0000
>>
>> 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.
>
> OK, done, and closing the bug.
Hello João and Eli,
Thanks for looking into it and applying the patch.
> Yaron, this change was small enough to accept without copyright
> assignment, but if you intend to continue contributing to Emacs (and
> we hope you do), I recommend to start your copyright assignment
> paperwork rolling at this time. If you agree, I will send you the
> form to fill and the instructions to email it.
Alright, please send it over.
Eshel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#60379
; Package
emacs
.
(Sat, 14 Jan 2023 10:53:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 60379-done <at> debbugs.gnu.org (full text, mbox):
> From: Eshel Yaron <me <at> eshelyaron.com>
> Cc: João Távora <joaotavora <at> gmail.com>,
> 60379-done <at> debbugs.gnu.org
> Date: Sat, 14 Jan 2023 11:33:27 +0200
>
> > Yaron, this change was small enough to accept without copyright
> > assignment, but if you intend to continue contributing to Emacs (and
> > we hope you do), I recommend to start your copyright assignment
> > paperwork rolling at this time. If you agree, I will send you the
> > form to fill and the instructions to email it.
>
> Alright, please send it over.
Form sent off-list.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 11 Feb 2023 12:24:12 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 46 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.