[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I make hl-line mode not override the color of rainbow-mode?

From: Yuri Khan
Subject: Re: How can I make hl-line mode not override the color of rainbow-mode?
Date: Fri, 27 Oct 2017 15:33:00 +0700

On Fri, Oct 27, 2017 at 2:23 PM, Eli Zaretskii <> wrote:

>> (I wish there was a way to make overlays interact better with text
>> properties. hl-line takes precedence over pretty much any background
>> color highlighting, including but not limited to hi-lock, rainbow-mode
>> and Magit branch and tag decorations.
> This could be alleviated by using less intrusive face attributes for
> the hl-line face.  For example, one could use underline, or
> bold/slant, or box, or something else that doesn't override the
> colors, while still making the current line stand out on display.

The idea of hl-line is not to make the current line “stand out” as
such. It is a delicate balance of several desirable properties:

1. The current line needs to be immediately noticeable.
  a. Even if it contains no characters or contains only whitespace.
2. The current line should not be too distracting.
  a. In particular, it must not cause glyphs shifting when point moves.
3. The current line is secondary to any characteristics of the text in
the buffer.

A very subtle change in background color (on the order of 8 gray
levels out of 256) fits those criteria except 3. Bold, slant and
underline fail #1a. Box fails #2a when the box line width is positive,
and sometimes also when negative. (In an *Info* buffer, a negative box
still causes shifting for me on Emacs 25.1.) If the box line width is
negative and big enough that it gives the effect of text background,
it also fails #3.

>> The intuitive expectation, for hl-line, would be that it should
>> override background color only if it comes directly or indirectly
>> from the default face.)
> I think I disagree, but then I don't use hl-line in my routine usage,
> so maybe my opinion isn't worth much.

That’s why I’m offering my opinion, which I acquired through 10 years
of Emacs and a few years of other editors before that.

(Of course I understand programming that behavior is technically
difficult given the overall scheme of things. An overlay is just not a
good enough fit for hl-line; an “underlay” would be more like it.)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]