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?

  • 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. – Drew Jan 17 '18 at 0:30
  • Hi Drew, thanks for the response. No they don't come out highlighted for me with emacs -Q. – SFbay007 Jan 17 '18 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. – Drew Jan 17 '18 at 0:35
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.

  • 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. – SFbay007 Jan 17 '18 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.