all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: 50989@debbugs.gnu.org
Subject: bug#50989: 28.0.60; nobreak-char-display in Eldoc buffers
Date: Sun, 03 Oct 2021 13:39:33 +0200	[thread overview]
Message-ID: <87fstixrpm.fsf@gmail.com> (raw)
In-Reply-To: <CALDnm50Ov0uG43i1Wfh8875RnMYnMDr6OG1jTuFgRPxcHc=Psg@mail.gmail.com> ("João Távora"'s message of "Sun, 3 Oct 2021 12:12:23 +0100")

[-- Attachment #1: Type: text/plain, Size: 1898 bytes --]

On Sun,  3 Oct 2021 at 12:12, João Távora <joaotavora@gmail.com> wrote:

> On Sun, Oct 3, 2021 at 12:07 PM Eli Zaretskii <eliz@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Disable-nobreak-char-display-in-Eldoc-buffers.patch --]
[-- Type: text/x-patch, Size: 914 bytes --]

From cfac0d542c751eef49b3482701d400aa2d2e38b4 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Sun, 3 Oct 2021 13:11:26 +0200
Subject: [PATCH] Disable 'nobreak-char-display' in Eldoc buffers

* lisp/emacs-lisp/eldoc.el (eldoc--format-doc-buffer): Set
'nobreak-char-display' to nil in Eldoc buffers
---
 lisp/emacs-lisp/eldoc.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 21f262adc6..a1c3c3268f 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -477,6 +477,7 @@ eldoc--format-doc-buffer
       (let ((inhibit-read-only t)
             (things-reported-on))
         (erase-buffer) (setq buffer-read-only t)
+        (setq-local nobreak-char-display nil)
         (local-set-key "q" 'quit-window)
         (cl-loop for (docs . rest) on docs
                  for (this-doc . plist) = docs
-- 
2.31.1


  parent reply	other threads:[~2021-10-03 11:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-03 10:02 bug#50989: 28.0.60; nobreak-char-display in Eldoc buffers Augusto Stoffel
2021-10-03 10:34 ` João Távora
2021-10-03 11:07   ` Eli Zaretskii
2021-10-03 11:12     ` João Távora
2021-10-03 11:25       ` Eli Zaretskii
2021-10-03 11:39       ` Augusto Stoffel [this message]
2021-10-05  9:13         ` Lars Ingebrigtsen
2021-10-05 21:16     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fstixrpm.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=50989@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.