# HG changeset patch # User Juri Linkov # Date 1123117734 0 # Node ID 0344b299e9e6b9f0b15c2db95bdac6c562a4ed30 # Parent 719375653e09c429762ec7d284754cfaa5296feb (grep-regexp-alist): Replace complex regexp matching line numbers, column numbers and their ranges with regexp matching only line numbers. (grep-context-face): New face variable. (grep-mode-font-lock-keywords): Use it. diff -r 719375653e09 -r 0344b299e9e6 lisp/progmodes/grep.el --- a/lisp/progmodes/grep.el Thu Aug 04 01:06:44 2005 +0000 +++ b/lisp/progmodes/grep.el Thu Aug 04 01:08:54 2005 +0000 @@ -248,13 +248,12 @@ ;;;###autoload (defvar grep-regexp-alist - ;; rms: I removed the code to match parens around the line number - ;; because it causes confusion and so we will find out if anyone needs it. - ;; It causes confusion with a file name that contains a number in parens. - '(("^\\(.+?\\)\\([: \t]\\)+\ -\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ -\\(?:-\\(?:\\([0-9]+\\)\\4\\)?\\.?\\([0-9]+\\)?\\)?\\2" - 1 (3 . 6) (5 . 7)) + '(("^\\([^:\n]+\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2" + 1 3) + ;; Rule to match column numbers is commented out since no known grep + ;; produces them + ;; ("^\\([^:\n]+\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2\\(?:\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?\\2\\)?" + ;; 1 3 (4 . 5)) ("^\\(\\(.+?\\):\\([0-9]+\\):\\).*?\ \\(\033\\[01;31m\\(?:\033\\[K\\)?\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)" 2 3 @@ -284,6 +283,9 @@ (defvar grep-match-face 'match "Face name to use for grep matches.") +(defvar grep-context-face 'shadow + "Face name to use for grep context lines.") + (defvar grep-mode-font-lock-keywords '(;; Command output lines. ("^\\([A-Za-z_0-9/\.+-]+\\)[ \t]*:" 1 font-lock-function-name-face) @@ -298,6 +300,7 @@ (0 '(face nil message nil help-echo nil mouse-face nil) t) (1 grep-error-face) (2 grep-error-face)) + ("^[^\n-]+-[0-9]+-.*" (0 grep-context-face)) ;; Highlight grep matches and delete markers ("\\(\033\\[01;31m\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)" ;; Refontification does not work after the markers have been