Mercurial > emacs
comparison lisp/progmodes/grep.el @ 57769:e663f6b659a6
(grep-regexp-alist): Move match highlighting
code to `grep-mode-font-lock-keywords'.
(grep-mode-font-lock-keywords): Delete grep markers instead
of making them invisible.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Thu, 28 Oct 2004 09:00:26 +0000 |
parents | cb013e5835b8 |
children | a4ed247d476f |
comparison
equal
deleted
inserted
replaced
57768:84cd4892a56e | 57769:e663f6b659a6 |
---|---|
1 ;;; grep.el --- run compiler as inferior of Emacs, parse error messages | 1 ;;; grep.el --- run compiler as inferior of Emacs, parse error messages |
2 | 2 |
3 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 1999, 2001, 02, 2004 | 3 ;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
4 ;; Free Software Foundation, Inc. | 4 ;; 2001, 2002, 2004 Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Roland McGrath <roland@gnu.org> | 6 ;; Author: Roland McGrath <roland@gnu.org> |
7 ;; Maintainer: FSF | 7 ;; Maintainer: FSF |
8 ;; Keywords: tools, processes | 8 ;; Keywords: tools, processes |
9 | 9 |
250 '(("^\\(.+?\\)[:( \t]+\ | 250 '(("^\\(.+?\\)[:( \t]+\ |
251 \\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ | 251 \\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ |
252 \\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:) \t]" 1 (2 . 5) (4 . 6)) | 252 \\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:) \t]" 1 (2 . 5) (4 . 6)) |
253 ("^\\(.+?\\)[:(]+\\([0-9]+\\)\\([:)]\\).*?\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" | 253 ("^\\(.+?\\)[:(]+\\([0-9]+\\)\\([:)]\\).*?\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" |
254 1 2 | 254 1 2 |
255 ;; Calculate column positions (beg . end) of first grep match on a line | |
255 ((lambda () | 256 ((lambda () |
256 (setq compilation-error-screen-columns nil) | 257 (setq compilation-error-screen-columns nil) |
257 (- (match-beginning 5) (match-end 3) 8)) | 258 (- (match-beginning 5) (match-end 3) 8)) |
258 . | 259 . |
259 (lambda () (- (match-end 5) (match-end 3) 8))) | 260 (lambda () (- (match-end 5) (match-end 3) 8)))) |
260 nil nil | |
261 (4 (list 'face nil 'invisible t 'intangible t)) | |
262 (5 (list 'face compilation-column-face)) | |
263 (6 (list 'face nil 'invisible t 'intangible t)) | |
264 ;; highlight other matches on the same line | |
265 ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" | |
266 nil nil | |
267 (1 (list 'face nil 'invisible t 'intangible t)) | |
268 (2 (list 'face compilation-column-face) t) | |
269 (3 (list 'face nil 'invisible t 'intangible t)))) | |
270 ("^Binary file \\(.+\\) matches$" 1 nil nil 1)) | 261 ("^Binary file \\(.+\\) matches$" 1 nil nil 1)) |
271 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") | 262 "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") |
272 | 263 |
273 (defvar grep-error "grep hit" | 264 (defvar grep-error "grep hit" |
274 "Message to print when no matches are found.") | 265 "Message to print when no matches are found.") |
292 (1 grep-hit-face nil t) | 283 (1 grep-hit-face nil t) |
293 (2 grep-error-face nil t)) | 284 (2 grep-error-face nil t)) |
294 ("^Grep \\(exited abnormally\\) with code \\([0-9]+\\).*" | 285 ("^Grep \\(exited abnormally\\) with code \\([0-9]+\\).*" |
295 (0 '(face nil message nil help-echo nil mouse-face nil) t) | 286 (0 '(face nil message nil help-echo nil mouse-face nil) t) |
296 (1 compilation-warning-face) | 287 (1 compilation-warning-face) |
297 (2 compilation-line-face))) | 288 (2 compilation-line-face)) |
289 ;; Highlight grep matches and delete markers | |
290 ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" | |
291 (2 compilation-column-face) | |
292 ((lambda (p)) | |
293 (progn | |
294 ;; Delete markers with `replace-match' because it updates | |
295 ;; the match-data, whereas `delete-region' would render it obsolete. | |
296 (replace-match "" t t nil 3) | |
297 (replace-match "" t t nil 1))))) | |
298 "Additional things to highlight in grep output. | 298 "Additional things to highlight in grep output. |
299 This gets tacked on the end of the generated expressions.") | 299 This gets tacked on the end of the generated expressions.") |
300 | 300 |
301 ;;;###autoload | 301 ;;;###autoload |
302 (defvar grep-program | 302 (defvar grep-program |