magit/magit — pull request #994 by tarsius (2013-10-13 17:23:13+00:00)
Title: add option magit-item-highlight-face

Add option `magit-item-highlight-face` to once and for all satisfy all
users, hopefully. Actually, that is not possible; so what this actually
does, is to allow users to customize the appearance of the highlighting
without imposing any limitations.

The previous attempt implemented in at least the commits 66a0644,
d14a3f9 (with discussion), and d14a3f9; and discussed in the issues #743
and #865 failed. They fixed it for some users and in turn broke it for
others. The primary goal of this change is to help users help
themselves, in case they don't like the defaults.

The new option `magit-item-highlight-face` is necessary because face
inheritance has serious limitations when a theme is used. It is not
possible for the user to "unset" a face attribute that was previously
set by the theme. All that is possible is to *change* it to some other
value. "Make unset" isn`t available as a value.

This option also makes it possible to automatically set the default of
option `magit-diff-use-overlays` to nil in *one particular* case: when
`magit-item-highlight-face`s value is `bold`. (We previously tried
something similar, but that failed because of another limitation of
faces, :set-after only works for options, not faces).

This commit also changes the appearance of some faces, which might
disappoint some users. There simply isn`t anything we can do to make
this look good out of the box for everyone. Unfortunately for some
people that will mean that we have switched from a default that worked
for them to one that doesn`t. I hope that, when pointed to this
message, it becomes obvious, that it isn`t as easy as one might have
thought, and that we had to make compromises.

The following considerations went into choosing the colors used for
various themes:

* Being at least _usable_ in (hopefully) all cases is more important
than being _pretty_ in most cases. We are not in the business of
designing consistent color themes.

* Inherit from default faces, hoping that doing so, results in
consistent, semantically sound, and possibly even pretty colors.
If that is not so that is the mistake of the theme authors.

* The colors red and green, in all its variations, have to be avoided
because those colors are also used to indicate removed and added lines
in diffs.

* Therefore inherit from default faces that, in the default theme (both
the dark and light variant), don't use such colors. Of course some
third-party theme might have changed these faces to use red or green;
we simply cannot do anything about that.

* The faces we inherit from also have to be semantically close to
"highlight". Which gives us `highlight`, `region`, and
`secondary-selection`.

* `region` cannot be used because it is also used for... the region,
which is useful when staging just a portion of a hunk, precisely *the
region*.

* `highlight` cannot be used because it is green.

* `secondary-selection` and only that remains. Use it. It might not
be pretty even when using the default theme, but if it is good enough
for the designers of the default theme then it is good enough for us.
Besides we don't have another option.

So make `magit-item-highlight` inherit from `secondary-selection` and
make `magit-item-mark` (which previously inherited from the former)
inherit from `highlight`. It`s okay for `magit-item-mark` to be green;
only commits can be marked, and commits don't appear next to added (or
removed, or unmodified) lines.