64 |
:version "21.4" |
:version "21.4" |
65 |
:group 'grep) |
:group 'grep) |
66 |
|
|
67 |
|
(defcustom grep-highlight-matches t |
68 |
|
"*Non-nil to use special markers to highlight grep matches. |
69 |
|
|
70 |
|
Some grep programs are able to surround matches with special |
71 |
|
markers in grep output. Such markers can be used to highlight |
72 |
|
matches in grep mode. |
73 |
|
|
74 |
|
This option sets the environment variable GREP_COLOR to specify |
75 |
|
markers for highlighting and GREP_OPTIONS to add the --color |
76 |
|
option in front of any explicit grep options before starting |
77 |
|
the grep." |
78 |
|
:type 'boolean |
79 |
|
:version "21.4" |
80 |
|
:group 'grep) |
81 |
|
|
82 |
(defcustom grep-scroll-output nil |
(defcustom grep-scroll-output nil |
83 |
"*Non-nil to scroll the *grep* buffer window as output appears. |
"*Non-nil to scroll the *grep* buffer window as output appears. |
84 |
|
|
245 |
'(("^\\(.+?\\)[:( \t]+\ |
'(("^\\(.+?\\)[:( \t]+\ |
246 |
\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ |
\\([0-9]+\\)\\([.:]?\\)\\([0-9]+\\)?\ |
247 |
\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:) \t]" 1 (2 . 5) (4 . 6)) |
\\(?:-\\(?:\\([0-9]+\\)\\3\\)?\\.?\\([0-9]+\\)?\\)?[:) \t]" 1 (2 . 5) (4 . 6)) |
248 |
|
("^\\(.+?\\)[:(]+\\([0-9]+\\)\\([:)]\\).*?\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" |
249 |
|
1 2 |
250 |
|
((lambda () |
251 |
|
(setq compilation-error-screen-columns nil) |
252 |
|
(- (match-beginning 5) (match-end 3) 8)) |
253 |
|
. |
254 |
|
(lambda () (- (match-end 5) (match-end 3) 8))) |
255 |
|
nil nil |
256 |
|
(4 (list 'face nil 'invisible t 'intangible t)) |
257 |
|
(5 (list 'face compilation-column-face)) |
258 |
|
(6 (list 'face nil 'invisible t 'intangible t)) |
259 |
|
;; highlight other matches on the same line |
260 |
|
("\\(\033\\[01;41m\\)\\(.*?\\)\\(\033\\[00m\\)" |
261 |
|
nil nil |
262 |
|
(1 (list 'face nil 'invisible t 'intangible t)) |
263 |
|
(2 (list 'face compilation-column-face) t) |
264 |
|
(3 (list 'face nil 'invisible t 'intangible t)))) |
265 |
("^Binary file \\(.+\\) matches$" 1 nil nil 1)) |
("^Binary file \\(.+\\) matches$" 1 nil nil 1)) |
266 |
"Regexp used to match grep hits. See `compilation-error-regexp-alist'.") |
"Regexp used to match grep hits. See `compilation-error-regexp-alist'.") |
267 |
|
|
332 |
(defun grep-process-setup () |
(defun grep-process-setup () |
333 |
"Setup compilation variables and buffer for `grep'. |
"Setup compilation variables and buffer for `grep'. |
334 |
Set up `compilation-exit-message-function' and run `grep-setup-hook'." |
Set up `compilation-exit-message-function' and run `grep-setup-hook'." |
335 |
|
(when grep-highlight-matches |
336 |
|
;; Modify `process-environment' locally bound in `compilation-start' |
337 |
|
(setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always")) |
338 |
|
(setenv "GREP_COLOR" "01;41")) |
339 |
(set (make-local-variable 'compilation-exit-message-function) |
(set (make-local-variable 'compilation-exit-message-function) |
340 |
(lambda (status code msg) |
(lambda (status code msg) |
341 |
(if (eq status 'exit) |
(if (eq status 'exit) |