highlight-symbol-mode
uses text properties, not an overlay.
hl-line-mode
uses an overlay, not text properties.
Overlays always take precedence over text properties, no matter how low the overlay priority is.
So without some coding or code tweaking, I don't see a solution.
However, if you use the Highlight library (highlight.el
) then the solution is simple.
Just use command hlt-highlight-symbol
. It is bound by default to C-x X h s
.
(All of the commands in this library are bound in keymap hlt-map
, which is bound by default to prefix key C-x X
. If you don't find C-x X
convenient, you can bind the keymap to another key. Or if you want to use only some of the commands in the library, you can of course bind those individually to keys.)
Here is a screenshot, showing symbol nb
highlighted and hl-line mode turned on. I use hl-line+.el
, but that shouldn't matter here. I did nothing special -- no tweaking of overlay priorities etc. I just loaded highlight.el
and hl-line+.el
, turned on hl-line-mode
, and used hlt-highlight-symbol
.
