emacs-devel
[Top][All Lists]
Advanced

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

GREP_OPTIONS again


From: Stefan
Subject: GREP_OPTIONS again
Date: Fri, 17 Sep 2004 00:51:09 -0400
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (darwin)

I just bumped into a bad side-effect of the GREP_OPTIONS thingy:
I grepped for MM and then isearched for `MM (', knowing full well there had
to be a match but it didn't find anything.

The problem was the invisible annotations added by grep because of
the --color.  I guess we should just remove them rather than make
them invisible.

The patch below is actually untested (for some reason my grep doesn't want
to add those annotations any more right now),


        Stefan


--- orig/lisp/progmodes/grep.el
+++ mod/lisp/progmodes/grep.el
@@ -1,7 +1,7 @@
 ;;; grep.el --- run compiler as inferior of Emacs, parse error messages
 
-;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001, 02, 2004
-;;  Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+;;   2001, 2002, 2004  Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
 ;; Maintainer: FSF
@@ -258,15 +258,17 @@
       .
       (lambda () (- (match-end 5) (match-end 3) 8)))
      nil nil
-     (4 (list 'face nil 'invisible t 'intangible t))
-     (5 (list 'face compilation-column-face))
-     (6 (list 'face nil 'invisible t 'intangible t))
+     ;; Delete annotations with `replace-match' because it updates
+     ;; the match-data, whereas `delete-region' would render it obsolete.
+     (5 (progn (replace-match "" t t nil 6)
+              (replace-match "" t t nil 4)
+              (list 'face font-lock-function-name-face)))
      ;; highlight other matches on the same line
      ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)"
       nil nil
-      (1 (list 'face nil 'invisible t 'intangible t))
-      (2 (list 'face compilation-column-face) t)
-      (3 (list 'face nil 'invisible t 'intangible t))))
+      (2 (progn (replace-match "" t t nil 3)
+               (replace-match "" t t nil 1)
+               (list 'face font-lock-function-name-face)))))
     ("^Binary file \\(.+\\) matches$" 1 nil nil 1))
   "Regexp used to match grep hits.  See `compilation-error-regexp-alist'.")
 




reply via email to

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