Commit 983203ee authored by Juri Linkov's avatar Juri Linkov
Browse files


(grep-mode-font-lock-keywords, grep-process-setup):
Use default GNU grep match color "01;31m" instead of "01;41m".
(grep-regexp-alist, grep-mode-font-lock-keywords):
Use `\\[[0-9]*m' instead of `\\[00m'.
(grep-regexp-alist): Move `\\(?:\033\\[K\\)?' from sgr_end to
sgr_start where its handling is more important.  Use the real
length of sgr_start instead of constant 8.
(grep-mode-font-lock-keywords): Don't delete `\\(?:\033\\[K\\)?'
specially.  Delete all remaining escape sequences.
(grep-process-setup): Set "GREP_COLORS" for GNU grep 2.5.1-cvs.
(grep-regexp-alist): Make hyperlink only for binary file name
instead of the whole line.
(grep-mode-map): Bind `backtab' to `compilation-previous-file'.
(grep-mode): Add autoload.
parent 4a397e9a
......@@ -196,6 +196,7 @@ See `compilation-error-screen-columns'"
(define-key map "p" 'previous-error-no-select)
(define-key map "{" 'compilation-previous-file)
(define-key map "}" 'compilation-next-file)
(define-key map [backtab] 'compilation-previous-file)
(define-key map "\t" 'compilation-next-file)
;; Set up the menu-bar
......@@ -255,16 +256,17 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
1 (3 . 6) (5 . 7))
2 3
;; Calculate column positions (beg . end) of first grep match on a line
((lambda ()
(setq compilation-error-screen-columns nil)
(- (match-beginning 5) (match-end 1) 8))
(setq compilation-error-screen-columns nil)
(- (match-beginning 4) (match-end 1)))
(lambda () (- (match-end 5) (match-end 1) 8)))
(lambda () (- (match-end 5) (match-end 1)
(- (match-end 4) (match-beginning 4)))))
nil 1)
("^Binary file \\(.+\\) matches$" 1 nil nil 1))
("^Binary file \\(.+\\) matches$" 1 nil nil 1 1))
"Regexp used to match grep hits. See `compilation-error-regexp-alist'.")
(defvar grep-error "grep hit"
......@@ -296,17 +298,21 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
(1 compilation-warning-face)
(2 compilation-line-face))
;; Highlight grep matches and delete markers
;; Refontification does not work after the markers have been
;; deleted. So we use the font-lock-face property here as Font
;; Lock does not clear that.
(2 (list 'face nil 'font-lock-face grep-match-face))
((lambda (p))
((lambda (bound))
;; Delete markers with `replace-match' because it updates
;; the match-data, whereas `delete-region' would render it obsolete.
(replace-match "" t t nil 3)
(replace-match "" t t nil 1)))))
(replace-match "" t t nil 1))))
;; Delete all remaining escape sequences
((lambda (bound))
(replace-match "" t t nil 1))))
"Additional things to highlight in grep output.
This gets tacked on the end of the generated expressions.")
......@@ -354,7 +360,10 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
(when (eq grep-highlight-matches t)
;; Modify `process-environment' locally bound in `compilation-start'
(setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always"))
(setenv "GREP_COLOR" "01;41"))
;; for GNU grep 2.5.1
(setenv "GREP_COLOR" "01;31")
;; for GNU grep 2.5.1-cvs
(setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:ml=:cx=:ne"))
(set (make-local-variable 'compilation-exit-message-function)
(lambda (status code msg)
(if (eq status 'exit)
......@@ -514,6 +523,7 @@ temporarily highlight in visited source lines."
'grep-mode nil highlight-regexp)))
(define-compilation-mode grep-mode "Grep"
"Sets `grep-last-buffer' and `compilation-window-height'."
(setq grep-last-buffer (current-buffer))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment