bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#2397: marked as done (23.0.90; grep no longer highlights the match)


From: Emacs bug Tracking System
Subject: bug#2397: marked as done (23.0.90; grep no longer highlights the match)
Date: Sat, 28 Feb 2009 17:50:03 +0000

Your message dated Sat, 28 Feb 2009 19:42:33 +0200
with message-id <address@hidden>
and subject line Re: bug#2397: 23.0.90; grep no longer highlights the match
has caused the Emacs bug report #2397,
regarding 23.0.90; grep no longer highlights the match
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact address@hidden
immediately.)


-- 
2397: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=2397
Emacs Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 23.0.90; grep no longer highlights the match Date: Thu, 19 Feb 2009 15:26:41 -0800
emacs -Q
 
load library cygwin-mount.el, then setup-cygwin.el:
 
http://www.emacswiki.org/emacs/cygwin-mount.el
http://www.emacswiki.org/emacs/setup-cygwin.el
 
M-x grep -nH -e pattern *.el
 
The text matching "pattern" is not highlighted. In Emacs 22 it is
highlighted using face `match' (yellow background).
 

In GNU Emacs 23.0.90.1 (i386-mingw-nt5.1.2600)
 of 2009-02-01 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
 




--- End Message ---
--- Begin Message --- Subject: Re: bug#2397: 23.0.90; grep no longer highlights the match Date: Sat, 28 Feb 2009 19:42:33 +0200
> From: "Drew Adams" <address@hidden>
> Date: Mon, 23 Feb 2009 16:56:14 -0800
> Cc: address@hidden
> 
> > >> Could you also try running grep from Bash (not from Emacs)
> > >> with options "--color=always" and "--color=auto" and see whether
> > >> it outputs highlighting sequences for both cases in a standalone
> > >> shell?
> > >
> > > Yes, both produce the highlighting.
> > > It is apparently only in Emacs that --color=auto does not work.
> > 
> > Weird.  Maybe a Windows guru could explain the difference.
> 
> I think it's an Emacs guru that's needed (perhaps with some Windows, Cygwin, 
> or
> GNU bash knowledge).

I think this has nothing to do with either Cygwin or Bash.  Drew,
could you please verify that the same problem happens for you in
"emacs -Q" without loading cygwin-mount.el and setup-cygwin.el?

AFAICT, this problem happens because Emacs on Windows invokes
subsidiary programs through a pipe, and that pipe fails the `isatty'
test in Grep.  So "--color=auto" can never work on MS-Windows when
Grep is invoked by Emacs.

I ``fixed'' this by going back, on DOS/Windows only, to the
"--color=always" way we used before Juri installed his 2007-11-23
changes.  It's true that this will reinstate the original problem with
multiple grep invocations in a pipe (on Windows and DOS only), but I
don't see how can that use-case be solved, and having a single
instance of grep in the command is by far more frequent usage.

Here's the change I installed.  Drew, could you please see if it works
for you as well?

2009-02-28  Eli Zaretskii  <address@hidden>

        * progmodes/grep.el (grep-process-setup) [windows-nt msdos]: Use
        "--color=always".

Index: lisp/progmodes/grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- lisp/progmodes/grep.el      25 Jan 2009 00:54:53 -0000      1.99
+++ lisp/progmodes/grep.el      28 Feb 2009 17:24:29 -0000      1.100
@@ -407,7 +407,11 @@
     ;; `--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"))
+    (setenv "GREP_OPTIONS"
+           (concat (getenv "GREP_OPTIONS")
+                   ;; Windows and DOS pipes fail `isatty' detection in Grep.
+                   " --color=" (if (memq system-type '(windows-nt ms-dos))
+                                   "always" "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


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]