Subject: bug#4911: mouse-face property should merge face attributes, not replace

From: Drew Adams <[email-masked]>
Date: Sun, 26 Apr 2020 10:22:09 -0700 (PDT)

> >> But to some extent it makes sense, since that's how links behave on
> >> the web (merging faces), so it's hart to fault users for having the
> >> same expectation in Emacs.
> >
> > Really?  A mouseover action over a link in a web browser
> > doesn't change the link appearance, by default.
> 
> Most websites do, I think (I just checked Google, the New York Times,
> and gnu.org), but you're right that the default style sheet doesn't
> include a face change..

I don't think I see that on nytimes.com or google.com.

I do see a mouseover "face" change on both, on inline
links in text, but what I see is all or nothing.  For
NYT, for example, a link is shown underlined, and
mouseover removes the underline - IOW, two different
"faces", and mouseover uses the same face for all of
the link text.

I don't see examples of link text that has (the
equivalent of) multiple faces, so I can't see what
happens with mouseover on such links.

Do you have an example of a link on some such site,
where the link text uses multiple "faces" and
mouseover preserves those faces while perhaps adding
or removing some "face attributes" across all of them?

> > The one case where I might want something like what
> > you propose (or maybe exactly like it, depending on
> > just what it is), would be when mouseover essentially
> > underlines (or overlines or otherwise doesn't
> > obscure) the text.  In that case, I can see a value
> > to continuing to show the foreground colors of the
> > underlined text - if that's realizable.
> 
> Yes yes yes!  We are in violent agreement here :)

I thought so.  But probably "more or less", and not
violently. ;-)

> > > Why is that helpful?
> >
> > It can perhaps be easier to see the extent of the
> > link?  Easier to notice the link?  Dunno.
> 
> With the change of background, it's actually quite readable.

I think it can depend on the background, and how it
interacts with the default/frame face and with the
faces used in the link text.  You may be right that
in general most mouseover backgrounds would not be
problematic; dunno.

> > Anyway, I agree that it's helpful to keep face
> > highlighting is some cases - in particular when,
> > say, an entire line of code is highlighted.
> > The effect of, say, `hl-line-mode' is what I
> > prefer in a case like that - and yes, that's
> > merging.  Similarly, for the region.  I think
> > it's less likely to be useful for links (i.e.,
> > for mouseover).  But I could be wrong.
> 
> Yup, I feel just the same about hl-line-mode and the region.  I find
> the effect of foreground colors being reset when the background changes
> due to hovering quite distracting, but I agree there's personal taste
> involved.

The question is really about links (mouseover).

> > It's fine to provide a way (some other way - e.g.
> > via a variable or another property or whatever)
> > to have mouseover merge a face instead of imposing
> > it.
> 
> Yes, I think all your suggestions are good approaches.

It would be good to try a patch, in some context where
there is already lots of use of different faces.  One
such context is the use of font-lock faces, but in most
such uses there isn't much predefined use of links.

> Thanks again for your input,

And thank you for the suggestion/bug report, and
attention to providing the new feature only as an
option/alternative.

(BTW, why doesn't the bug # appear in the subject line?)