Subject: Re: 26.1; Region highlight has lower priority than flymake overlays

From: Johann Klähn <[email-masked]>
Date: Thu, 10 Jan 2019 22:06:42 +0100

(Sorry, I initially forgot to CC the bug tracker.)

Hi João,

thanks for your quick response! I did not see `flymake-overlay-control' because I was still using
the version of flymake shipped with Emacs 26.1. (I really like the options introduced with the new
version allows, so I will probably switch to using it.)

On Wed, Jan 9, 2019, at 21:52, João Távora wrote:
> Johann Klähn <[email-masked]> writes:
> > • M-: (set-face-background flymake-note "yellow green")
> 
> You probably mean 
> 
> (set-face-background 'flymake-note "yellow green")
Exactly :)

> Yes, it was intentional.  Doesn't mean that it's correct :-) Perhaps it
> should be reduced to the 50's region and also use the (nil . <value>),
> form which I didn't know about (so thanks for showing me this).

Wrt. to using non-numeric priority values maybe Eli Zaretskii could chime in, because there is the
following section ("Overlay Properties") in the Emacs Lisp manual, which he wrote (see Bug#20253):

‖ ‘priority’
‖      This property’s value determines the priority of the overlay.  If
‖      you want to specify a priority value, use either ‘nil’ (or zero),
‖      or a positive integer.  Any other value has undefined behavior.
‖      [...]
‖      Note that Emacs sometimes uses non-numeric priority values for some
‖      of its internal overlays, so do not try to do arithmetic on the
‖      priority of an overlay (unless it is one that you created).  In
‖      particular, the overlay used for showing the region uses a priority
‖      value of the form ‘(PRIMARY . SECONDARY)’, where the PRIMARY value
‖      is used as described above, and SECONDARY is the fallback value
‖      used when PRIMARY and the nesting considerations fail to resolve
‖      the precedence between overlays.  However, you are advised not to
‖      design Lisp programs based on this implementation detail; if you
‖      need to put overlays in priority order, use the SORTED argument of
‖      ‘overlays-at’.  *Note Finding Overlays::.

Even though it's shipped with Emacs, flymake is probably not "internal" enough to use those?

...looking around further I just found Bug#16192, where a similar problem was fixed for hl-line-mode
by using a negative priority.  And then there is also Bug#15899, which discusses the use of overlays
to highlight region in the first place.