(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
\\(?:-\\(?:\\([0-9]+\\)\\4\\)?\\.?\\([0-9]+\\)?\\)?\\2"
1 (3 . 6) (5 . 7))
("^\\(\\(.+?\\):\\([0-9]+\\):\\).*?\
-\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\(?:\033\\[K\\)?\\)"
+\\(\033\\[01;31m\\(?:\033\\[K\\)?\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)"
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"
(1 compilation-warning-face)
(2 compilation-line-face))
;; Highlight grep matches and delete markers
- ("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\(?:\033\\[K\\)?\\)"
+ ("\\(\033\\[01;31m\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)"
;; 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))
(progn
;; 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))))
+ ("\\(\033\\[[0-9;]*[mK]\\)"
+ ;; 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.")
(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)
command-args)
'grep-mode nil highlight-regexp)))
+;;;###autoload
(define-compilation-mode grep-mode "Grep"
"Sets `grep-last-buffer' and `compilation-window-height'."
(setq grep-last-buffer (current-buffer))