GNU bug report logs -
#75379
30.0.93; project-find-regexp expects "C" or "en" locale
Previous Next
Full log
Message #86 received at 75379 <at> debbugs.gnu.org (full text, mbox):
On 07/01/2025 19:39, Juri Linkov wrote:
> This is a known problem. Since the exit status is unreliable,
> this is why 'grep-exit-message' has to use such a trick that
> no output (i.e. '(not (buffer-modified-p))') indicates no matches:
What about errors, though? Missing programs, unsupported flags, etc.
Maybe Grep gets by without that due to the explicit probing step in
grep-compute-defaults, but I'm not sure it's worth building up its
counterpart in xref.el.
> (if (eq status 'exit)
> ;; This relies on the fact that `compilation-start'
> ;; sets buffer-modified to nil before running the command,
> ;; so the buffer is still unmodified if there is no output.
> (cond ((and (zerop code) (buffer-modified-p))
> (if (> grep-num-matches-found 0)
> (cons (format (ngettext "finished with %d match found\n"
> "finished with %d matches found\n"
> grep-num-matches-found)
> grep-num-matches-found)
> "matched")
> '("finished with matches found\n" . "matched")))
> ((not (buffer-modified-p))
> '("finished with no matches found\n" . "no match"))
>
>> Also, when we know the format of come messages we can parse the file name
>> out of them and create a button in the output buffer. Simply copying any
>> unhandled messages removes that possibility.
> Can we detect a file name in any message, e.g. by matching a path separator?
We use 'grep --null', so the file name separator is a zero byte.
We could scan the buffer to see whether there are any zero bytes (and if
none - that would mean no matches), but the "binary file matches"
message doesn't use that separator ¯\_(ツ)_/¯
Not does it start with a file name, so we have to have a separate
understanding about that message's structure anyway:
grep: test/lisp/gnus/mml-sec-resources/pubring.kbx: binary file matches
grep: test/lisp/gnus/mml-sec-resources/secring.gpg: binary file matches
grep: test/lisp/gnus/mml-sec-resources/trustdb.gpg: binary file matches
This bug report was last modified 217 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.