Option next-error-highlight controls highlighting of compilation and grep hits in the source buffers. The possibilities for this are these:
- highlight for a given time or until the next command
- highlight until the next command or until next hit visit
- do not highlight
- show location in fringe -- which indication moves with the locus
If you use library simple+.el, then you have another possibility: highlight until the locus moves. This highlights, like the first two possibilities above, but the highlighting does not go away -- it just moves, like the last possibility above (fringe).
That sounds like what you want. (It is what I use.) For grep, for instance, the matching text is highlighted in the source file at the location you visit. It stays highlighted until you visit a different hit.
The same holds for the similar option next-error-highlight-no-select.
In addition, for grep and compilation to respect the new value provided by simple+.el, you will also need libraries grep+.el and
compile+.el, respectively.