From d44b855b0ccb9d97261735316b25cbccbb150550 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Wed, 28 Jan 2026 21:55:40 +0200 Subject: [PATCH] xref-matches-in-directory: Don't error on "Binary file ... matches" * lisp/progmodes/xref.el (xref-matches-in-directory): Consider the "Binary file ... matches" message (bug#80246). --- lisp/progmodes/xref.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index df9e00a0d36..d2817a95b17 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1900,7 +1900,9 @@ If DELIMITED is `symbol', only select matches that span full symbols." ;; exit with non-zero. "No matches" and "Grep program not found" ;; are all the same to it. (when (and (/= (point-min) (point-max)) - (not (looking-at grep-re))) + (not (looking-at grep-re)) + ;; See also this check in `xref-matches-in-files'. + (not (looking-at ".*[bB]inary file.* matches"))) (user-error "Search failed with status %d: %s" status (buffer-string))) (while (re-search-forward grep-re nil t) (push (list (string-to-number (match-string line-group))