65 |
:group 'grep) |
:group 'grep) |
66 |
|
|
67 |
(defcustom grep-highlight-matches 'auto-detect |
(defcustom grep-highlight-matches 'auto-detect |
68 |
"*If t, use special markers to highlight grep matches. |
"If t, use special markers to highlight grep matches. |
69 |
|
|
70 |
Some grep programs are able to surround matches with special |
Some grep programs are able to surround matches with special |
71 |
markers in grep output. Such markers can be used to highlight |
markers in grep output. Such markers can be used to highlight |
74 |
This option sets the environment variable GREP_COLOR to specify |
This option sets the environment variable GREP_COLOR to specify |
75 |
markers for highlighting and GREP_OPTIONS to add the --color |
markers for highlighting and GREP_OPTIONS to add the --color |
76 |
option in front of any explicit grep options before starting |
option in front of any explicit grep options before starting |
77 |
the grep." |
the grep. |
78 |
|
|
79 |
|
The default value of this variable is set up by `grep-compute-defaults'; |
80 |
|
call that function before using this variable in your program." |
81 |
:type '(choice (const :tag "Do not highlight matches with grep markers" nil) |
:type '(choice (const :tag "Do not highlight matches with grep markers" nil) |
82 |
(const :tag "Highlight matches with grep markers" t) |
(const :tag "Highlight matches with grep markers" t) |
83 |
(other :tag "Not Set" auto-detect)) |
(other :tag "Not Set" auto-detect)) |
337 |
(defun grep-process-setup () |
(defun grep-process-setup () |
338 |
"Setup compilation variables and buffer for `grep'. |
"Setup compilation variables and buffer for `grep'. |
339 |
Set up `compilation-exit-message-function' and run `grep-setup-hook'." |
Set up `compilation-exit-message-function' and run `grep-setup-hook'." |
340 |
(when grep-highlight-matches |
(unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
341 |
|
(grep-compute-defaults)) |
342 |
|
(when (eq grep-highlight-matches t) |
343 |
;; Modify `process-environment' locally bound in `compilation-start' |
;; Modify `process-environment' locally bound in `compilation-start' |
344 |
(setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always")) |
(setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always")) |
345 |
(setenv "GREP_COLOR" "01;41")) |
(setenv "GREP_COLOR" "01;41")) |
425 |
(unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
(unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
426 |
(setq grep-highlight-matches |
(setq grep-highlight-matches |
427 |
(with-temp-buffer |
(with-temp-buffer |
428 |
(and (equal (condition-case nil |
(and (equal (condition-case nil |
429 |
(call-process grep-program nil t nil "--help") |
(call-process grep-program nil t nil "--help") |
430 |
(error nil)) |
(error nil)) |
431 |
0) |
0) |
432 |
(progn |
(progn |
433 |
(goto-char (point-min)) |
(goto-char (point-min)) |
434 |
(search-forward "--color" nil t)) |
(search-forward "--color" nil t)) |
435 |
t))))) |
t))))) |
436 |
|
|
437 |
(defun grep-default-command () |
(defun grep-default-command () |
438 |
(let ((tag-default |
(let ((tag-default |