64 |
:version "21.4" |
:version "21.4" |
65 |
:group 'grep) |
:group 'grep) |
66 |
|
|
67 |
(defcustom grep-highlight-matches t |
(defcustom grep-highlight-matches 'auto-detect |
68 |
"*Non-nil to 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 |
:type 'boolean |
|
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) |
82 |
|
(const :tag "Highlight matches with grep markers" t) |
83 |
|
(other :tag "Not Set" auto-detect)) |
84 |
:version "21.4" |
:version "21.4" |
85 |
:group 'grep) |
:group 'grep) |
86 |
|
|
115 |
|
|
116 |
The default value of this variable is set up by `grep-compute-defaults'; |
The default value of this variable is set up by `grep-compute-defaults'; |
117 |
call that function before using this variable in your program." |
call that function before using this variable in your program." |
|
:type 'boolean |
|
118 |
:type '(choice (const :tag "Do Not Append Null Device" nil) |
:type '(choice (const :tag "Do Not Append Null Device" nil) |
119 |
(const :tag "Append Null Device" t) |
(const :tag "Append Null Device" t) |
120 |
(other :tag "Not Set" auto-detect)) |
(other :tag "Not Set" auto-detect)) |
185 |
(let ((map (cons 'keymap compilation-minor-mode-map))) |
(let ((map (cons 'keymap compilation-minor-mode-map))) |
186 |
(define-key map " " 'scroll-up) |
(define-key map " " 'scroll-up) |
187 |
(define-key map "\^?" 'scroll-down) |
(define-key map "\^?" 'scroll-down) |
188 |
|
(define-key map "\C-c\C-f" 'next-error-follow-minor-mode) |
189 |
|
|
190 |
;; This is intolerable -- rms |
;; This is intolerable -- rms |
191 |
;;; (define-key map [remap next-line] 'compilation-next-error) |
;;; (define-key map [remap next-line] 'compilation-next-error) |
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")) |
421 |
(format "%s <D> <X> -type f <F> -print | xargs %s <R>" |
(format "%s <D> <X> -type f <F> -print | xargs %s <R>" |
422 |
find-program gcmd)) |
find-program gcmd)) |
423 |
(t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;" |
(t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;" |
424 |
find-program gcmd null-device))))))) |
find-program gcmd null-device)))))) |
425 |
|
(unless (or (not grep-highlight-matches) (eq grep-highlight-matches t)) |
426 |
|
(setq grep-highlight-matches |
427 |
|
(with-temp-buffer |
428 |
|
(and (equal (condition-case nil |
429 |
|
(call-process grep-program nil t nil "--help") |
430 |
|
(error nil)) |
431 |
|
0) |
432 |
|
(progn |
433 |
|
(goto-char (point-min)) |
434 |
|
(search-forward "--color" nil t)) |
435 |
|
t))))) |
436 |
|
|
437 |
(defun grep-default-command () |
(defun grep-default-command () |
438 |
(let ((tag-default |
(let ((tag-default |
500 |
command-args) |
command-args) |
501 |
'grep-mode nil highlight-regexp))) |
'grep-mode nil highlight-regexp))) |
502 |
|
|
503 |
;;;###autoload (autoload 'grep-mode "grep" nil t) |
;;; This doesn't work: |
504 |
|
;;; ###autoload (autoload 'grep-mode "grep" nil t) |
505 |
|
;;; The ostensibly correct result is nonetheless opaque to the accounting |
506 |
|
;;; done in `generate-file-autoloads'; in loaddefs.el, the generated elisp is |
507 |
|
;;; correct but the generated header comment for grep.el lacks `grep-mode'. |
508 |
|
;;; This approach also doesn't help other users of `define-compilation-mode' |
509 |
|
;;; who wish to autoload. |
510 |
|
;;; |
511 |
|
;;; Better to extend autoload.el to grok `define-compilation-mode'. |
512 |
|
|
513 |
|
;;;###autoload |
514 |
(define-compilation-mode grep-mode "Grep" |
(define-compilation-mode grep-mode "Grep" |
515 |
"Sets `grep-last-buffer' and `compilation-window-height'." |
"Sets `grep-last-buffer' and `compilation-window-height'." |
516 |
(setq grep-last-buffer (current-buffer)) |
(setq grep-last-buffer (current-buffer)) |