unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* GREP_OPTIONS again
@ 2004-09-17  4:51 Stefan
  2004-09-17 14:00 ` Miles Bader
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan @ 2004-09-17  4:51 UTC (permalink / raw)



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 <roland@gnu.org>
 ;; 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'.")

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-02 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-17  4:51 GREP_OPTIONS again Stefan
2004-09-17 14:00 ` Miles Bader
2004-09-17 23:23 ` Richard Stallman
2004-10-02 23:45 ` Juri Linkov

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).