From: "Mattias Engdegård" <mattiase@acm.org>
To: 49978@debbugs.gnu.org
Subject: bug#49978: 28.0.50; grep-highlight-matches auto-detection broken on macOS [PATCH]
Date: Tue, 10 Aug 2021 14:54:43 +0200 [thread overview]
Message-ID: <6D6B9A78-50EC-4AEC-80AA-EB12C608EB48@acm.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
The auto-detection of colourised grep fails on macOS (and presumably BSD in general) because grep --help exits with a nonzero status (while still printing a useful option summary).
We should just ignore the exit status. Anyone against the attached patch?
[-- Attachment #2: grep-highlight-matches-autodetect.diff --]
[-- Type: application/octet-stream, Size: 896 bytes --]
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 8f0a5acf70..a33a247d9b 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -696,11 +696,11 @@ grep-compute-defaults
(when (eq grep-highlight-matches 'auto-detect)
(setq grep-highlight-matches
(with-temp-buffer
- (and (grep-probe grep-program '(nil t nil "--help"))
- (progn
- (goto-char (point-min))
- (search-forward "--color" nil t))
- ;; Windows and DOS pipes fail `isatty' detection in Grep.
+ ;; The "grep --help" exit status varies; pay no attention to it.
+ (grep-probe grep-program '(nil t nil "--help"))
+ (goto-char (point-min))
+ (and (search-forward "--color" nil t)
+ ;; Windows and DOS pipes fail `isatty' detection in Grep.
(if (memq system-type '(windows-nt ms-dos))
'always 'auto)))))
next reply other threads:[~2021-08-10 12:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 12:54 Mattias Engdegård [this message]
2021-08-10 13:23 ` bug#49978: 28.0.50; grep-highlight-matches auto-detection broken on macOS [PATCH] Eli Zaretskii
2021-08-10 13:39 ` Mattias Engdegård
2021-08-10 13:57 ` Eli Zaretskii
2021-08-10 14:03 ` Lars Ingebrigtsen
2021-08-10 15:11 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6D6B9A78-50EC-4AEC-80AA-EB12C608EB48@acm.org \
--to=mattiase@acm.org \
--cc=49978@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).