Subject: Re: bug#62029: 29.0.60; Allow users to customize eldoc buffer separator

From: Yuan Fu <[email-masked]>
Date: Thu, 23 Mar 2023 17:12:15 -0700

> On Mar 23, 2023, at 2:33 PM, João Távora <[email-masked]> wrote:
> 
> Yuan Fu <[email-masked]> writes:
> 
>> I agree. But in the same time, eldoc’s rendering should be
>> customizable too. If someone uses eldoc-doc-buffer and want to use
>> fancier separators, they should be able to. That’ll be easier than
>> writing another displayer that does everything the same as
>> eldoc-doc-buffer except for using a different separator.
> 
> I've pushed two commits to master that address the design shortcoming I
> was referring to.  Here they are summarized:
> 
> commit e19994fe8c000b0ed2dbc667cdec26cf54356907
>    ElDoc: rework rendering of echo area (bug#62029)
> 
>    Previously, the display function 'eldoc-display-in-echo-area' reused
>    the same buffer as 'eldoc-display-in-doc-buffer', but that made it
>    harder to render documentation items differently depending on the
>    specific constraints of each display functions.
> 
> commit 9b18407c7fd91313544acfb3457be5447987e20a
>    ElDoc: remember origin backend in doc snippets (bug#62029)
> 
>    This lays groundwork for discriminating between different
>    documentation providers in ElDoc display outlets, i.e. members
>    of eldoc-display-functions
> 
> The first commit detaches eldoc-display-in-echo-area from
> eldoc-display-in-doc-buffer (It also allows the backend to control the
> display in the echo area specifically).  For the purposes of this bug,
> it should allow eldoc-display-in-doc-buffer to more freely structure the
> *eldoc* buffer with separators, etc.
> 
> The second commit adds a :origin cookie to each doc item passed to
> eldoc-display-functions.  The origin is the name of the backend itself.
> It could allow for better separators in the *eldoc* buffer where each
> section is titled according to the backend that produced the
> documentation.
> 
> So I guess what's missing for this bug is a customizable *eldoc* buffer
> separator with a good default value, like one of those resize-resisting
> horizontal separators.  Also, for customization, maybe `format-spec' can
> be used?

Brilliant! On top of format-spec, maybe also a face for the title, like eldoc-source-title.

For separator, maybe something like

(insert “Title" (propertize "-" 'display
                            '(space :align-to right)
                            'font-lock-face '(:strike-through t)
                            'face '(:strike-through t)))

for GUI, and use underline for terminal.

Yuan