GNU bug report logs -
#75379
30.0.93; project-find-regexp expects "C" or "en" locale
Previous Next
Full log
Message #83 received at 75379 <at> debbugs.gnu.org (full text, mbox):
>> Indeed, "Binary file matches" is a very important message that
>> helps not to miss any matches in a text file that happens
>> to accidentally contain a NUL byte. This saved me many times
>> while using rgrep. 'project-find-regexp' could do the same,
>> and show the same messages in the*xref* output buffer.
>> So to not mess with translations, a simpler solution would be
>> just to copy all unhandled messages from grep/ripgrep output
>> to the xref buffer as is.
>
> Good point, maybe we could show different messages this way.
It would be nice to keep all unprocessed lines.
> But I think what I was trying to do there is distinguish between Grep
> succeeding and ending up with an error (which we should report with
> user-error), and the process exit status wasn't enough for that.
>
> Indeed, here's a command to try:
>
> git ls-files -z | xargs -0 grep gtags
>
> In the Emacs repository (among others) it exits with the status 123,
> apparently one or more of the Grep sub-invocations ended up with non-zero
> status (likely 1, indicating "no matches"). Even though the combined search
> finds a bunch of results, that doesn't change xargs's exit status. And we
> can't special-case the status 123 because "if any invocation of the command
> exited with status 1-125" covers both Grep calls that found nothing and
> Grep calls which were done with unrecognized flags (Grep exit status 2,
> IIUC).
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:
(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?
This bug report was last modified 160 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.