Search code examples
searchemacshighlighting

How to get highlighting from interactive regex search in emac to remain highlight until deactivated?


How to get highlighting from interactive regex search in emac to remain highlight until deactivated? For instance, with the text provided and running M-C-s (Regexp I-Search) with input 'file' will highlight the 3 'file' words in the text below.

;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.

Regexp I-Search %> file

But, once I start to edit the file the highlighting will disappear. I'd like to keep the highlighting for a while -- until I run another command to turn it off. How could I do this?


Solution

  • You're looking for highlight-regexp bound to M-s h r. M-s h u unhighlights.

    highlight-symbol provides a nice wrapper around this.