Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable nobreak-char-display in view modes #661

Closed
astoff opened this issue Oct 3, 2021 · 8 comments
Closed

Disable nobreak-char-display in view modes #661

astoff opened this issue Oct 3, 2021 · 8 comments

Comments

@astoff
Copy link

astoff commented Oct 3, 2021

Distinguishing non-breaking spaces and the like is generally not useful in {markdown,gfm}-view-mode. So these modes should set nobreak-char-display to nil by default. Another option would be to tie this setting to the value of markdown-hide-markup.

I encounter this issue often in Eglot's eldoc buffers, which use gfm-view-mode to prettify markdown text received from an external process. This markdown sometimes contains lots non-breaking spaces. Note the red undelining in all the indented lines of the screenshot below.

image

Actual Behavior

The global value of nobreak-char-display applies to {markdown,gfm}-view-mode buffers.

Steps to Reproduce

In a scratch buffer, enter a non-breaking space (C-x 8 RET non-breaking space RET). The nobreak-space face will be applied to that character. Now type M-x gfm-view-mode RET. The nobreak-space face remains, but it should disappear.

Backtrace

Not needed.

Software Versions

  • Markdown Mode: 2.4
  • Emacs: 28.0.60
  • OS: Fedora
@astoff
Copy link
Author

astoff commented Oct 3, 2021

Ah, now I see this won't solve the Eglot problem, since it copies the gfm-view-mode buffer contents to another buffer. It might still make sense to fix this in markdown-mode, but please feel free to ignore it.

@doolio
Copy link

doolio commented Dec 7, 2022

Did you find a solution for this with Eglot?

@astoff
Copy link
Author

astoff commented Dec 8, 2022

Yes, this has been fixed on the Eldoc side.

@astoff astoff closed this as completed Dec 8, 2022
@doolio
Copy link

doolio commented Dec 8, 2022

Yes, this has been fixed on the Eldoc side.

Fully? I still see similar "underlining" and "&nbsp" when using the pyright language server. See examples here and here.

@astoff
Copy link
Author

astoff commented Dec 8, 2022

I have never used this language server or seen that particular problem. Now, I think this can only be solved on the markdown-mode side.

Eglot already renders correctly asterisks that demarcate list items, turning them into . So if markdown-mode learns to render the HTML entities, I'm pretty sure all will be fine on the Eglot/Eldoc side. (I'm not necessarily saying that this should be done, and incidentally I'd regard it a bug for a language server to produce unreadable markdown.)

@doolio
Copy link

doolio commented Dec 8, 2022

I see, thank you. From the discussion under the second link I shared it seems the pyright team only guarantee to target the markdown renderer supported by the VSCode LSP client.

@astoff
Copy link
Author

astoff commented Dec 9, 2022

This is of course dumb; if there was a good reason to mangle the markdown to the point it's unreadable in the raw, then LSP should support transmitting text as HTML instead. Unfortunately, I see LSP more and more as a VS Code interface that others are invited to use at their own peril than a truly editor-agnostic protocol.

@doolio
Copy link

doolio commented Dec 9, 2022

Sadly, I think you may be right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants