Subject: Re: bug#71282: 30.0.50; hl-line overlay priority has no affect

From: João Távora <[email-masked]>
Date: Sun, 30 Jun 2024 17:37:52 +0100

On Sun, Jun 30, 2024 at 4:50 PM João Távora <[email-masked]> wrote:
>
> On Sun, Jun 30, 2024 at 4:34 PM Eli Zaretskii <[email-masked]> wrote:
>
> > The mechanism exists: find the face of the buffer text, and use it (or
> > some of its attributes, like background color) in determining the face
> > of the overlay string.
>
> Then if that mechanism doesn't require anything specific of package X or
> Y, it should be possible to condense in a function (that shouldn't live in
> Eglot, but OK it it starts life there, I guess) that takes a face with
> a number of
> attributes,merges with whatever is "the face of the buffer text" and return
> an (anonymous) face.  If so, then that "mistery" function is the fix
> to this issue.
>
>                         (overlay-put ov (if peg-after-p 'before-string
> 'after-string)
>                                      (propertize
>                                       text
> -                                     'face (pcase kind
> -                                             (1 'eglot-type-hint-face)
> -                                             (2 'eglot-parameter-hint-face)
> -                                             (_ 'eglot-inlay-hint-face))))
> +                                     'face
> +                                     (mistery (pcase kind
> +                                                (1 'eglot-type-hint-face)
> +                                                (2 'eglot-parameter-hint-face)
> +                                                (_ 'eglot-inlay-hint-face)))))

Never mind, this won't work as whatever face is determined
at any given moment, will cease to be adequate as soon as the
hl-line extension chooses another face for those positions.
So if no low-level automatic merging of overlay faces is to
happen in the display engine, this problem doesn't have a solution.
Or maybe hl-line could forcibly and constantly repropertize all the
overlays on a given line with a given background color if that
attribute isn't explicit in the overlay's faces (main text, before string
or after string).  Then restore those things it as soon as the line is
released.  If this idea is not too complicated, too brittle or too
inneficient, it is at any rate not something that concerns Eglot.

João