You might need to look at the Magit code to see what it is doing. You don't say what highlighting Magit does normally, and just what changes when highlight-chars.el
(Highlight Library) is added to the mix. I don't use Magit -- maybe someone else can speak to this.
But highlight-chars.el
does add to font-lock-keywords
for things like highlighting tabs and trailing whitespace. It's possible that this interferes with the font-lock keywords used by Magit.
However, user option hc-font-lock-override
controls whether the current highlighting face used by hc-*
commands overrides (t
), is overridden by (keep
), or merges with (append
or prepend
) any existing highlighting.
You should thus be able to make hc-*
highlighting cohabit well with other text-property highlighting - you can control which highlighting of a given piece of text, highlighting by hc-*
or highlighting by some other code, has precedence, and how much it dominates the other highlighting.
E.g., you can set the value of hc-font-lock-override
to keep
(e.g., using M-x customize-option hc-font-lock-override
), to prevent hc-*
highlighting from overwriting any already existing highlighting.
See also options hc-other-chars
and hc-other-chars-NOT
, which control which chars are governed by hc-toggle-highlight-other-chars
.
You might also try changing the order (i.e., when you turn on the hc-*
highlighting). hc-highlight-trailing-whitespace
and hc-highlight-tabs
just add patterns to match at the end of font-lock-keywords
.
However, be aware that highlighting from text properties (e.g. face
or font-lock-face
) always has less precedence than highlighting from overlays. Library highlight-chars.el
uses text-property highlighting, as does all use of font-lock. If some other library uses overlay highlighting on the same text area then the overlay highlighting wins in case of conflict - always.
[2018-04-07: I updated highlight-chars.el
to let option hc-font-lock-override
(previously called hc-other-chars-font-lock-override
) control all hc-*
highlighting, not just other-char highlighting.]
whitespace-mode
in a magit buffer. Never got around to investigating further though.