From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#2397: 23.0.90; grep no longer highlights the match Date: Sun, 22 Feb 2009 09:56:52 -0800 Message-ID: <000f01c99516$f20a9a10$0200a8c0@us.oracle.com> References: <011f01c992e9$854a3cc0$c2b22382@us.oracle.com> Reply-To: Drew Adams , 2397@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1235327042 27376 80.91.229.12 (22 Feb 2009 18:24:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Feb 2009 18:24:02 +0000 (UTC) To: <2397@emacsbugs.donarmstrong.com>, Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 22 19:25:17 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LbJ0n-00019z-U9 for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Feb 2009 19:25:10 +0100 Original-Received: from localhost ([127.0.0.1]:42922 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LbIzT-0003Vw-7N for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Feb 2009 13:23:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LbIzN-0003VR-Fr for bug-gnu-emacs@gnu.org; Sun, 22 Feb 2009 13:23:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LbIzM-0003Uy-Mj for bug-gnu-emacs@gnu.org; Sun, 22 Feb 2009 13:23:40 -0500 Original-Received: from [199.232.76.173] (port=47221 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LbIzL-0003Uh-Ry for bug-gnu-emacs@gnu.org; Sun, 22 Feb 2009 13:23:39 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:39254) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LbIzL-0005FH-3t for bug-gnu-emacs@gnu.org; Sun, 22 Feb 2009 13:23:39 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n1MINaMU023348; Sun, 22 Feb 2009 10:23:37 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n1MI58Vp018918; Sun, 22 Feb 2009 10:05:08 -0800 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: "Drew Adams" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 22 Feb 2009 18:05:08 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 2397 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 2397-submit@emacsbugs.donarmstrong.com id=B2397.123532540916559 (code B ref 2397); Sun, 22 Feb 2009 18:05:08 +0000 Original-Received: (at 2397) by emacsbugs.donarmstrong.com; 22 Feb 2009 17:56:49 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from acsinet12.oracle.com (acsinet12.oracle.com [141.146.126.234]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n1MHugP2016542 for <2397@emacsbugs.donarmstrong.com>; Sun, 22 Feb 2009 09:56:44 -0800 Original-Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by acsinet12.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n1MHuPEM013716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 22 Feb 2009 17:56:26 GMT Original-Received: from acsmt703.oracle.com (acsmt703.oracle.com [141.146.40.81]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n1MHuYGl015526; Sun, 22 Feb 2009 17:56:35 GMT Original-Received: from dradamslap1 (/24.5.128.33) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 22 Feb 2009 17:56:31 +0000 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <011f01c992e9$854a3cc0$c2b22382@us.oracle.com> Thread-Index: AcmS6YTmtoP0BBShQVezwEtGCqmHggCKGwIQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt703.oracle.com [141.146.40.81] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A09020B.49A191D1.0227:SCFSTAT928724,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Sun, 22 Feb 2009 13:23:40 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:25594 gmane.emacs.pretest.bugs:23971 Archived-At: The bug seems to have been introduced here: Revision 1.81 - (view) (download) (annotate) - [select for diffs] Fri Nov 23 00:32:05 2007 UTC (15 months ago) by jurta Branch: MAIN Changes since 1.80: +9 -4 lines Diff to previous 1.80 (grep-process-setup): Set envvar "TERM" to "emacs-grep". Set envvar "GREP_OPTIONS" to "--color=auto" instead of "--color=always". That change seems to have removed the pattern highlighting, by changing this: (defun grep-process-setup () "Setup compilation variables and buffer for `grep'. Set up `compilation-exit-message-function' and run `grep-setup-hook'." (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) (grep-compute-defaults)) (when (eq grep-highlight-matches t) ;; Modify `process-environment' locally bound in `compilation-start' (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always")) ;; for GNU grep 2.5.1 (setenv "GREP_COLOR" "01;31") ;; for GNU grep 2.5.1-cvs (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:ml=:cx=:ne")) (set (make-local-variable 'compilation-exit-message-function) (lambda (status code msg) (if (eq status 'exit) (cond ((zerop code) '("finished (matches found)\n" . "matched")) ((= code 1) '("finished with no matches found\n" . "no match")) (t (cons msg code))) (cons msg code)))) (run-hooks 'grep-setup-hook)) To this: (defun grep-process-setup () "Setup compilation variables and buffer for `grep'. Set up `compilation-exit-message-function' and run `grep-setup-hook'." (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) (grep-compute-defaults)) (when (eq grep-highlight-matches t) ;; `setenv' modifies `process-environment' let-bound in `compilation-start' ;; Any TERM except "dumb" allows GNU grep to use `--color=auto' (setenv "TERM" "emacs-grep") ;; `--color=auto' emits escape sequences on a tty rather than on a pipe, ;; thus allowing to use multiple grep filters on the command line ;; and to output escape sequences only on the final grep output (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=auto")) ;; GREP_COLOR is used in GNU grep 2.5.1, but deprecated in later versions (setenv "GREP_COLOR" "01;31") ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:ml=:cx=:ne")) (set (make-local-variable 'compilation-exit-message-function) (lambda (status code msg) (if (eq status 'exit) (cond ((zerop code) '("finished (matches found)\n" . "matched")) ((= code 1) '("finished with no matches found\n" . "no match")) (t (cons msg code))) (cons msg code)))) (run-hooks 'grep-setup-hook)) Eval'ing the former is enough to restore the pattern highlighting. Even more specifically, it is the change from (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always")) to (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=auto")) that introduces the bug. Putting back `always' in place of `auto' restores the highlighting. Why `auto' doesn't work, I don't know. Again, I have Cygwin on MS Windows, and my shell is bash. I don't know how to determine my Cygwin version, but it seems to date from 2007-08-22. In any case, Emacs should work with older versions of Cygwin also, and the version I have does support highlighting, if `--color=always' is used. `man grep' shows this for me, which seems to indicate that `auto' is also supported, but it doesn't say what `auto' means/does(!): --colour[=WHEN], --color[=WHEN] Surround the matching string with the marker find in GREP_COLOR environment variable. WHEN may be `never', `always', or `auto' GREP_OPTIONS This variable specifies default options to be placed in front of any explicit options. For example, if GREP_OPTIONS is '--binary-files=without-match --directories=skip', grep behaves as if the two options --binary-files=without-match and --direc- tories=skip had been specified before any explicit options. Option specifications are separated by whitespace. A backslash escapes the next character, so it can be used to specify an option containing whitespace or a backslash. GREP_COLOR Specifies the marker for highlighting.