Subject: bug#63828: 29.0.90; project-query-replace-regexp tries to find-and-replace in binary files

From: Dmitry Gutov <[email-masked]>
Date: Sat, 3 Jun 2023 04:47:02 +0300

On 01/06/2023 23:16, Spencer Baugh wrote:
> 1. emacs -Q
> 2. Open a git repository which has some binary files committed, or any
> other project that has binary files.
> 3. C-x p r foo bar
> 4. query-replace will enter the binary files
> 
> Perhaps it should not do this?  Perhaps fileloop-initialize-replace
> should skip binary files?  Perhaps by some customization?

It would be useful if you compare to what project-find-regexp does in 
such project: does it produce the matches in said binary files?

If it behaves better (from your POV), one solution could be to 
pre-filter the list of project files using the same search, before 
passing them to project-query-replace-regexp. It can have benefits in 
performance as well.

(BTW JFYI, you can press 'r' inside the project-find-regexp output 
buffer instead of using 'project-query-replace-regexp'.)