GNU bug report logs -
#50989
28.0.60; nobreak-char-display in Eldoc buffers
Previous Next
Reported by: Augusto Stoffel <arstoffel <at> gmail.com>
Date: Sun, 3 Oct 2021 10:03:01 UTC
Severity: normal
Tags: patch
Found in version 28.0.60
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.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 50989 in the body.
You can then email your comments to 50989 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Sun, 03 Oct 2021 10:03:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Augusto Stoffel <arstoffel <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
joaotavora <at> gmail.com, bug-gnu-emacs <at> gnu.org
.
(Sun, 03 Oct 2021 10:03:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Using the pylsp language server via Eglot, I sometimes get docstrings
with lots of non-breaking spaces in them. Those end up being
highlighted with the `nobreak-space' face in the Eldoc buffer, which is
very distracting.
I'm not sure this should be addressed in Eglot or in Eldoc. But the
following advice fixes things for me.
(advice-add 'eldoc--format-doc-buffer :after
(lambda (&rest _) "Don't display non-breaking spaces."
(with-current-buffer eldoc--doc-buffer
(setq-local nobreak-char-display nil))))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Sun, 03 Oct 2021 10:35:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 50989 <at> debbugs.gnu.org (full text, mbox):
On Sun, Oct 3, 2021 at 11:03 AM Augusto Stoffel <arstoffel <at> gmail.com> wrote:
>
> Using the pylsp language server via Eglot, I sometimes get docstrings
> with lots of non-breaking spaces in them. Those end up being
> highlighted with the `nobreak-space' face in the Eldoc buffer, which is
> very distracting.
>
> I'm not sure this should be addressed in Eglot or in Eldoc. But the
> following advice fixes things for me.
>
> (advice-add 'eldoc--format-doc-buffer :after
> (lambda (&rest _) "Don't display non-breaking spaces."
> (with-current-buffer eldoc--doc-buffer
> (setq-local nobreak-char-display nil))))
I'd say put this in ElDoc directly. If someone then objects, we could make a
eldoc-no-break-char-display variable. Can you make a patch?
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Sun, 03 Oct 2021 11:09:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 50989 <at> debbugs.gnu.org (full text, mbox):
> From: João Távora <joaotavora <at> gmail.com>
> Date: Sun, 3 Oct 2021 11:34:32 +0100
> Cc: 50989 <at> debbugs.gnu.org
>
> On Sun, Oct 3, 2021 at 11:03 AM Augusto Stoffel <arstoffel <at> gmail.com> wrote:
> >
> > Using the pylsp language server via Eglot, I sometimes get docstrings
> > with lots of non-breaking spaces in them. Those end up being
> > highlighted with the `nobreak-space' face in the Eldoc buffer, which is
> > very distracting.
> >
> > I'm not sure this should be addressed in Eglot or in Eldoc. But the
> > following advice fixes things for me.
> >
> > (advice-add 'eldoc--format-doc-buffer :after
> > (lambda (&rest _) "Don't display non-breaking spaces."
> > (with-current-buffer eldoc--doc-buffer
> > (setq-local nobreak-char-display nil))))
>
> I'd say put this in ElDoc directly. If someone then objects, we could make a
> eldoc-no-break-char-display variable. Can you make a patch?
IMNSHO, this doesn't make much sense. That face exists for a reason:
to signal to the users that some innocently-looking characters aren't
what they look like. What you suggest above is to sweep the problem
under the carpet. I think this is not TRT.
Why does the server return these NBSP characters? Would it make sense
to automatically convert them to spaces on input?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Sun, 03 Oct 2021 11:13:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 50989 <at> debbugs.gnu.org (full text, mbox):
On Sun, Oct 3, 2021 at 12:07 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
> IMNSHO, this doesn't make much sense. That face exists for a reason:
> to signal to the users that some innocently-looking characters aren't
> what they look like.
Eldoc's display facilities are only for displaying. Sure, you may want
to copy text away from there, but I'd say that's rare. So it wouldn't
be a problem
in practice, unless I'm missing something
> Why does the server return these NBSP characters? Would it make sense
> to automatically convert them to spaces on input?
That's also sweeping it under the rug. But I don't object either. Augusto, if
you agree, match a patch to Eglot (this is where I presume the "input"
Eli refers
to lives). Of course the real input is the server, but I'd rather not
go there, since
there are so many and all are out of our control.
João
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Sun, 03 Oct 2021 11:26:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 50989 <at> debbugs.gnu.org (full text, mbox):
> From: João Távora <joaotavora <at> gmail.com>
> Date: Sun, 3 Oct 2021 12:12:23 +0100
> Cc: Augusto Stoffel <arstoffel <at> gmail.com>, 50989 <at> debbugs.gnu.org
>
> > Why does the server return these NBSP characters? Would it make sense
> > to automatically convert them to spaces on input?
>
> That's also sweeping it under the rug.
Well, we have no control on what the server does, so we cannot do
better. But I do wonder why they do it at all.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Sun, 03 Oct 2021 11:40:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 50989 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sun, 3 Oct 2021 at 12:12, João Távora <joaotavora <at> gmail.com> wrote:
> On Sun, Oct 3, 2021 at 12:07 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> IMNSHO, this doesn't make much sense. That face exists for a reason:
>> to signal to the users that some innocently-looking characters aren't
>> what they look like.
>
> Eldoc's display facilities are only for displaying. Sure, you may want
> to copy text away from there, but I'd say that's rare. So it wouldn't
> be a problem
> in practice, unless I'm missing something
I agree -- this is for display only, in which case NBSP and space are
supposed to be indistinguishable. With the attached patch, if you copy
the text from the Eldoc buffer to some other buffer, the NBSPs are still
there so they will be displayed as such.
>> Why does the server return these NBSP characters? Would it make sense
>> to automatically convert them to spaces on input?
I don't know for sure what the thinking is in any particular server, but
there are sensible reasons why one might do this. Suppose, for
instance, that the client editor decides to refill the text before
displaying it. Then it might be relevant to add NBSPs at strategic
places, and removing them would produce strange results.
> That's also sweeping it under the rug. But I don't object either. Augusto, if
> you agree, match a patch to Eglot (this is where I presume the "input"
> Eli refers
> to lives). Of course the real input is the server, but I'd rather not
> go there, since
> there are so many and all are out of our control.
I don't know how to do this on the Eglot side, or at least not in a
simple manner: Eldoc callbacks take a string, not a buffer, as argument,
and Eldoc buffers are reused whenever possible.
So I've attached a patch implementing the simplistic solution. Feel
free to ignore it if this seems unsuitable.
[0001-Disable-nobreak-char-display-in-Eldoc-buffers.patch (text/x-patch, attachment)]
Added tag(s) patch.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Mon, 04 Oct 2021 09:46:01 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Tue, 05 Oct 2021 09:14:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 50989 <at> debbugs.gnu.org (full text, mbox):
Augusto Stoffel <arstoffel <at> gmail.com> writes:
>> Eldoc's display facilities are only for displaying. Sure, you may want
>> to copy text away from there, but I'd say that's rare. So it wouldn't
>> be a problem
>> in practice, unless I'm missing something
>
> I agree -- this is for display only, in which case NBSP and space are
> supposed to be indistinguishable. With the attached patch, if you copy
> the text from the Eldoc buffer to some other buffer, the NBSPs are still
> there so they will be displayed as such.
I can see arguments for both ways of doing this -- "cleaning up" the
string before display, and fixing the display (as your patch is doing).
I think the main argument here -- that eldoc buffers are for display
only, so nbsp should be displayed as normal space -- is compelling,
though, so I've applied your patch to Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 28.1, send any further explanations to
50989 <at> debbugs.gnu.org and Augusto Stoffel <arstoffel <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 05 Oct 2021 09:14:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50989
; Package
emacs
.
(Tue, 05 Oct 2021 21:17:02 GMT)
Full text and
rfc822 format available.
Message #30 received at 50989 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> IMNSHO, this doesn't make much sense. That face exists for a reason:
> to signal to the users that some innocently-looking characters aren't
> what they look like. What you suggest above is to sweep the problem
> under the carpet. I think this is not TRT.
That feature is useful for text that you're editing.
But I don't think it is useful in a help string which is displayed
only for you to read. So I think it is good to suppress it for
help strings generally.
The only exception I can imagine would be if a doc string displays an
example of buffer or file contents containing a non-breaking space.
In principle, it would be good to make an exception for that case.
But I think that exceptional case would be difficult to detect
reliably. Also, since doc strings generally don't include examples of
buffer or file contents, I think that case will never actually occur.
So I think we can get away with ignoring it.
It is ever worth doing, we could create a kind of quoting to force a
real NBSP into the displayed help string.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 03 Nov 2021 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 223 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.