all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Felician Nemeth <felician.nemeth@gmail.com>
Cc: 61072@debbugs.gnu.org, Wei-Ting Lin <linwaytin@gmail.com>
Subject: bug#61072: How to change the length of the separation lines in eldoc, used by eglot?
Date: Tue, 28 Mar 2023 23:27:27 +0100	[thread overview]
Message-ID: <87jzz0se9c.fsf@gmail.com> (raw)
In-Reply-To: <87o7oc6h5b.fsf@betli.tmit.bme.hu> (Felician Nemeth's message of "Tue, 28 Mar 2023 17:16:00 +0200")

Felician Nemeth <felician.nemeth@gmail.com> writes:

> João Távora <joaotavora@gmail.com> writes:
>
>> See docstring of eldoc-documentation-functions.
>
> The docstring is quite easy to follow.  Nice work.
>
>> I stopped short of adding :content-type there.  There's not much point
>> in moving rendering from Eglot to ElDoc if the rendering is going to
>> suck just as bad.  So I think this has to be analyzed carefully.  Here
>> are some ideas:
>>
>> 1. Use eww to render HTML, as you suggest.  But how to get that HTML?
>>    Call an external process?
>
> My idea was to leave the door open for a potential ElDoc backend that
> produces raw HTML documentation.  But it is a half-backed idea.  I don't
> know how images should be specified.  Just as an IMG tag: <img
> src="example.jpg">.  Or inline like in an email.
>
> If I understood correctly, one of your original ideas was to let ElDoc
> backends (Eglot) to specify a flag whether the documentation was in
> markdown format.  Using terminology of the
> eldoc-documentation-functions, I simply suggested a :content-type key to
> generalize the markdown flag hoping Emacs had helper functions to help
> handling a content-type specification.

Yes, exactly.  I ended up not following up on my idea because we don't
have a very good markdown renderer yet, so it's not particularly useful
to introduce this indirection yet.  And this content-type idea of yours
seemed more generic, more ambitious, and generally better.

> Unfortunately, I now see a small problem with the :content-type
> approach.  How should Eglot know whether ElDoc can render a markdown
> formatted documentation?  If Eglot can request the documentation in
> multiple formats, how it should know which one to choose.

I was going to just have Eglot ask Eldoc: "do you support Markdown?" and
then report the corresponding capability to the server.

>> 3. Lobby for markdown.el to become more render-friendly, (remove hard
>>    newlines from paragraphs, remove invisible text, etc.)
>
> Sure, but can a better markdown.el solve the original issue?  Is there a
> way to render a separation line independently of the current
> window-width?

Yes, there is, with just the same code we use in eldoc now to separate
documentation from different backends.

   (concat "\n" (propertize "\n" 'face '(:inherit separator-line :extend
   t)) "\n")

I've mailed Jason Blevins, markdown.el maintainer but he hasn't
responded.  Maybe make a bug report in the Github repo.

But window-width independence doesn't end there.  A proper renderer
would probably remove hard new lines in markdown paragraphs, so that
text can be wrapped automatically to windows with visual-line-mode does.
Or another way to get the same effect.

>> 4. Make a new Markdown mode based on a tree-sitter grammar
>
> I think a simple mode just to view a markdown document would be useful.
> However, tree-sitter only helps parse a document.  Turning an abstract
> syntax tree into a viewable Emacs buffer is still a substantial work, I
> suppose.

You're right, but one has to start somewhere...  Or not.  Maybe a couple
of patches to markdown.el and a gfm-render-mode with no hard newlines in
paragraphs (presuming markdown.el knows where paragraphs live) is the
shortest path to victory?

João





  reply	other threads:[~2023-03-28 22:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26  1:42 bug#61072: How to change the length of the separation lines in eldoc, used by eglot? Wei-Ting Lin
2023-01-26 11:12 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-27  1:08   ` Wei-Ting Lin
2023-02-09 17:05 ` Felician Nemeth
2023-02-18 15:08   ` Wei-Ting Lin
2023-02-21 17:11     ` Felician Nemeth
2023-02-21 17:19       ` João Távora
2023-03-15 12:07         ` Felician Nemeth
2023-03-23 21:59           ` João Távora
2023-03-28 15:16             ` Felician Nemeth
2023-03-28 22:27               ` João Távora [this message]
2023-03-29 17:48                 ` Felician Nemeth
2023-03-29 23:59                   ` Yuan Fu
2023-04-08  8:52                     ` Felician Nemeth
2023-04-08  9:10                       ` João Távora
2023-03-23 21:53 ` João Távora

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=87jzz0se9c.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=61072@debbugs.gnu.org \
    --cc=felician.nemeth@gmail.com \
    --cc=linwaytin@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.