1

I am liking rgrep as it lets you choose a path and searches recursively. How is it possible to highlight the matches in the rgrep buffer?

3
  • The matches are highlighted, for me. Do you not see match highlighting if you start Emacs using emacs -Q (no init file)? If you see the highlighting in that case then bisect your init file to find out what is interfering. Commented Jan 17, 2018 at 0:30
  • Hi Drew, thanks for the response. No they don't come out highlighted for me with emacs -Q. Commented Jan 17, 2018 at 0:34
  • OK. Might be a problem of Emacs version or a problem with your particular find command. Dunno. Works for me, with Emacs 23 to Emacs 26. Commented Jan 17, 2018 at 0:35

1 Answer 1

3

grep (rgrep) uses two settings (that I know of) to control highlighting in the *grep* buffer

  • font-lock-mode
  • grep-highlight-matches - customization variable

grep-highlight-matches depends on font-lock-mode being on. It can inherit its value from grep-host-defaults-alist. It controls the use of the GREP_COLORS environment variable and grep --color argument.

In your case I'd check that font-lock-mode is enabled. From the *grep* buffer enter: C-h v font-lock-mode and see what the *Help* buffer says. The easiest way to enable it in all buffers that support font locking is to call (global-font-lock-mode t)

You can also enter M-x font-lock-fontify-buffer on a per buffer basis.

I recall it not being enabled for me in older versions of emacs and/or on certain terminals.

1
  • Thanks for your comment. It was actually the "match" attribute. I added this `(match ((t (:foreground "#f2804f" :weight bold)))) to custom-theme-set-faces and that did it. Commented Jan 17, 2018 at 5:34

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.