diff options
Diffstat (limited to 'lisp/progmodes/grep.el')
-rw-r--r-- | lisp/progmodes/grep.el | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 4378a7c253d..6dc5fcabd41 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -206,7 +206,7 @@ See `compilation-error-screen-columns'" (define-key map [menu-bar grep compilation-compile] '("Compile..." . compile)) (define-key map [menu-bar grep compilation-grep] - '("Another grep" . grep)) + '("Another grep..." . grep)) (define-key map [menu-bar grep compilation-recompile] '("Repeat grep" . recompile)) (define-key map [menu-bar grep compilation-separator2] @@ -244,11 +244,11 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies ;;;###autoload (defvar grep-regexp-alist - '(("^\\([^:\n]+\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2" + '(("^\\(.+?\\)\\(:[ \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\\)?" + ;; ("^\\(.+?\\)\\(:[ \t]*\\)\\([0-9]+\\)\\2\\(?:\\([0-9]+\\)\\(?:-\\([0-9]+\\)\\)?\\2\\)?" ;; 1 3 (4 . 5)) ("^\\(\\(.+?\\):\\([0-9]+\\):\\).*?\ \\(\033\\[01;31m\\(?:\033\\[K\\)?\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)" @@ -261,7 +261,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies (lambda () (- (match-end 5) (match-end 1) (- (match-end 4) (match-beginning 4))))) nil 1) - ("^Binary file \\(.+\\) matches$" 1 nil nil 1 1)) + ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1)) "Regexp used to match grep hits. See `compilation-error-regexp-alist'.") (defvar grep-error "grep hit" @@ -272,8 +272,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies (defvar grep-hit-face compilation-info-face "Face name to use for grep hits.") -;; compilation-error-face is wrong for this; it's designed to look like a link. -(defvar grep-error-face font-lock-keyword-face +(defvar grep-error-face 'compilation-error "Face name to use for grep error messages.") (defvar grep-match-face 'match @@ -288,15 +287,17 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$" 1 grep-error-face) ;; remove match from grep-regexp-alist before fontifying + ("^Grep started.*" + (0 '(face nil message nil help-echo nil mouse-face nil) t)) ("^Grep finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*" (0 '(face nil message nil help-echo nil mouse-face nil) t) - (1 font-lock-keyword-face nil t) - (2 font-lock-keyword-face nil t)) - ("^Grep \\(exited abnormally\\) with code \\([0-9]+\\).*" + (1 compilation-info-face nil t) + (2 compilation-warning-face nil t)) + ("^Grep \\(exited abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code \\([0-9]+\\)\\)?.*" (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)) + (2 grep-error-face nil t)) + ("^.+?-[0-9]+-.*\n" (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 @@ -517,11 +518,10 @@ temporarily highlight in visited source lines." ;; Setting process-setup-function makes exit-message-function work ;; even when async processes aren't supported. - (let ((compilation-process-setup-function 'grep-process-setup)) - (compilation-start (if (and grep-use-null-device null-device) - (concat command-args " " null-device) - command-args) - 'grep-mode nil highlight-regexp))) + (compilation-start (if (and grep-use-null-device null-device) + (concat command-args " " null-device) + command-args) + 'grep-mode nil highlight-regexp)) ;;;###autoload (define-compilation-mode grep-mode "Grep" @@ -531,6 +531,9 @@ temporarily highlight in visited source lines." grep-hit-face) (set (make-local-variable 'compilation-error-regexp-alist) grep-regexp-alist) + (set (make-local-variable 'compilation-process-setup-function) + 'grep-process-setup) + (set (make-local-variable 'compilation-disable-input) t) ;; Set `font-lock-lines-before' to 0 to not refontify the previous ;; line where grep markers may be already removed. (set (make-local-variable 'font-lock-lines-before) 0)) |