And the rg (ripgrep) manual page says:

  By default, ripgrep attempts to automatically skip binary files in order to improve the relevance of results and make the search  faster.

And ugrep support -I in with the same meaning as grep.

Thus I propose to add both -I to grep and ugrep, remove the processing of search output for binary file messages, and extend doc string for users to be aware that the behavior has (slightly) changed.

I can provide a patch in those lines if needed.

Le dim. 5 janv. 2025 à 22:22, Matthias Meulien <orontee@gmail.com> a écrit :
Can't we instead have a database of these messages, like we do with
the "password" prompts?

I am not familiar with all grep options but I saw that:

‘-I’
     Process a binary file as if it did not contain matching data; this
     is equivalent to the ‘--binary-files=without-match’ option.

Just tested

  (setq xref-search-program-alist '((grep . "xargs -0 grep <C> --null -snHE -I -e <R>"))

and it works fine on my side.
--
Matthias


--
Matthias