Subject: bug#75379: 30.0.93; project-find-regexp expects "C" or "en" locale

From: Matthias Meulien <[email-masked]>
Date: Sun, 5 Jan 2025 11:35:31 +0100

1. Make sure you have a Git repository with binary files containing say
  the "copyright" word; One can clone
  https://github.com/orontee/lesmotsdugene/ for example.

2. Start Emacs using a locale different from "C" or other English based
locales, for example "fr_FR.UTF8":

   LANG=fr_FR.UTF8 emacs -Q

3. Then call `project-find-regexp' in the the Git repository identified
  in step 1, and search for the word "copyright"; There's no results but
  the following error message:

  xref-matches-in-files: Search failed with status 0: grep:
content/images/planche_1.png : fichiers binaires correspondent

If Emacs is started with "C" locale, then there are results!

The problem comes from `xref-matches-in-files', precisely this block
where `grep' output has been hardcoded even if depending on the locale:

  (when (and (/= (point-min) (point-max))
                   (not (looking-at grep-re))
                   ;; TODO: Show these matches as well somehow?
                   ;; Matching both Grep's and Ripgrep 13's messages.
                   (not (looking-at ".*[bB]inary file.* matches")))
          (user-error "Search failed with status %d: %s" status
                      (buffer-substring (point-min) (line-end-position))))

As quick fix one cas use:

(map-do (lambda (key val)
 (map-put xref-search-program-alist
  key (concat "LANG=C " val)))
xref-search-program-alist)

In GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2025-01-01 built on peitho
Repository revision: 7acfea19358da3a02e5884f5e7d56c87d7b16616
Repository branch: emacs-30
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-pgtk CFLAGS=-O3'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Markdown

Minor modes in effect:
  highlight-changes-visible-mode: t
  goto-address-mode: t
  pulsar-global-mode: t
  pulsar-mode: t
  breadcrumb-mode: t
  breadcrumb-local-mode: t
  outline-minor-mode: t
  guess-language-mode: t
  flyspell-mode: t
  desktop-save-mode: t
  spacious-padding-mode: t
  savehist-mode: t
  server-mode: t
  pixel-scroll-precision-mode: t
  save-place-mode: t
  electric-pair-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  vertico-mode: t
  global-display-fill-column-indicator-mode: t
  global-so-long-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  remember-notes-mode: t
  which-key-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/matthias/.config/emacs/elpa/which-key-20240620.2145/which-key hides
/usr/local/share/emacs/30.0.93/lisp/which-key
/home/matthias/.config/emacs/elpa/modus-themes-20241228.1050/theme-loaddefs
hides /usr/local/share/emacs/30.0.93/lisp/theme-loaddefs

Features:
(shadow sort mail-extr emacsbug mm-archive network-stream url-cache
debbugs-gnu add-log debbugs soap-client url-http url-auth url-gw nsm
debbugs-compat tabify cus-start pcmpl-unix pcmpl-gnu edebug etags
fileloop bug-reference quail misearch multi-isearch cl-print tramp-cache
time-stamp shortdoc rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid
rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn
nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-enc xmltok generic
dired-aux mhtml-mode css-mode js sgml-mode facemenu find-dired ffap
help-fns radix-tree vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
log-view pcvs-util mule-util vc-dir vc hl-line display-line-numbers
hilit-chg goto-addr oc-basic org-element org-persist org-id org-refile
org-element-ast inline avl-tree generator ol-eww eww url-queue mm-url
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015
mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku
url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range message sendmail yank-media puny rfc822 mml mml-sec epa epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util mail-utils range mm-util mail-prsvr ol-docview
doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m
ol-doi org-link-doi org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-src sh-script smie executable ob-comint org-pcomplete
org-list org-footnote org-faces org-entities ob-emacs-lisp ob-core
ob-eval org-cycle org-table ol org-fold org-fold-core org-keys oc
org-loaddefs cal-menu calendar cal-loaddefs org-version org-compat
org-macs pulsar eglot external-completion jsonrpc xref flymake ert ewoc
debug backtrace breadcrumb pulse imenu peitho-custom cus-edit cus-load
wid-edit dired-x dired dired-loaddefs grep reftex reftex-loaddefs
reftex-vars tex-mode compile markdown-mode edit-indirect color sql view
thingatpt scheme info-look python project pcase c++-ts-mode c-ts-mode
c-ts-common treesit skeleton find-file gdb-mi bindat gud noutline
outline ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help
ediff-init ediff-util smerge-mode diff vc-git diff-mode track-changes
vc-dispatcher glasses whitespace guess-language flyspell find-func
ispell comp comp-cstr cl-extra warnings comp-run comp-common desktop
frameset spacious-padding modus-vivendi-tritanopia-theme
modus-vivendi-deuteranopia-theme modus-vivendi-tinted-theme
modus-vivendi-theme modus-operandi-tritanopia-theme
modus-operandi-deuteranopia-theme modus-operandi-tinted-theme
modus-operandi-theme modus-themes savehist server bookmark
text-property-search pp pixel-scroll cua-base time tar-mode arc-mode
archive-mode saveplace tramp-sh tramp trampver tramp-integration files-x
tramp-message help-mode tramp-compat xdg shell pcomplete comint ansi-osc
ring parse-time iso8601 time-date format-spec ansi-color tramp-loaddefs
elec-pair corfu marginalia vertico compat easy-mmode
display-fill-column-indicator so-long autorevert filenotify autoinsert
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs generic-x derived remember diminish which-key face-remap
CMake-doc-autoloads Python-doc-autoloads breadcrumb-autoloads
cmake-mode-autoloads consult-autoloads corfu-autoloads debbugs-autoloads
devhelp-autoloads diminish-autoloads edit-indirect-autoloads
git-link-autoloads gnu-elpa-keyring-update-autoloads
guess-language-autoloads marginalia-autoloads markdown-mode-autoloads
meson-mode-autoloads modus-themes-autoloads nginx-mode-autoloads
powershell-autoloads pulsar-autoloads restclient-autoloads
rfc-mode-autoloads info spacious-padding-autoloads speechd-el-autoloads
systemd-autoloads rx tldr-autoloads vertico-autoloads
which-key-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs icons password-cache json subr-x map byte-opt
gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win
touch-screen pgtk-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 1437487 391817) (symbols 48 45565 30)
 (strings 32 242916 64728) (string-bytes 1 8371886) (vectors 16 86880)
 (vector-slots 8 1873292 92379) (floats 8 5893 1984)
 (intervals 56 42369 288) (buffers 992 95))

-- 
Matthias