Subject: Re: bug#13718: [patch] prevents hl-line from overriding highlight-mode

From: Stefan Monnier <[email-masked]>
Date: Fri, 15 Feb 2013 12:30:48 -0500

>> hl-line seems to leave its overlay's priority unspecified (good!), which
>> means that it should take precedence over overlays which are larger
>> (e.g. span multiple lines) while smaller overlays within the current
>> line should take precedence over it.

> That's actually a reasonable alternative to my hard-coded solution,
> but the problem is that it doesn't seem to work in every case: when I
> open a file that has syntax highlighting (e.g. Bash or Python) and
> then use highlight-phrase/regexp, the global-hl-line will have higher
> priority than the highlight, no matter what the size of the highlight
> is.  If I do the same thing in text-mode, the problem does not occur.
> (This was tested on 24.2.1-i386-mingw-nt6.1.7601  without any custom
> configuration.)

That's a different issue: in most major modes, font-lock will be enable,
in which case hi-lock uses it, which implies that hi-lock will use
text-properties instead of overlays.  And text-properties always have
lower priority than overlays.
Problem is: in such a case, not only you do have a problem, but your
patch should make no difference, so overlays always take priority over
text-properties, no matter the value of the `priority' property.

IOW, are you sure your patch fixes the problem for you?

        Stefan