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) |
420 |
(let ((tag-default |
(let ((tag-default |
421 |
(funcall (or find-tag-default-function |
(funcall (or find-tag-default-function |
422 |
(get major-mode 'find-tag-default-function) |
(get major-mode 'find-tag-default-function) |
423 |
;; We use grep-tag-default instead of |
'find-tag-default))) |
|
;; find-tag-default, to avoid loading etags. |
|
|
'grep-tag-default))) |
|
424 |
(sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)") |
(sh-arg-re "\\(\\(?:\"\\(?:[^\"]\\|\\\\\"\\)+\"\\|'[^']+'\\|[^\"' \t\n]\\)+\\)") |
425 |
(grep-default (or (car grep-history) grep-command))) |
(grep-default (or (car grep-history) grep-command))) |
426 |
;; Replace the thing matching for with that around cursor. |
;; Replace the thing matching for with that around cursor. |
491 |
(set (make-local-variable 'compilation-error-regexp-alist) |
(set (make-local-variable 'compilation-error-regexp-alist) |
492 |
grep-regexp-alist)) |
grep-regexp-alist)) |
493 |
|
|
|
;; This is a copy of find-tag-default from etags.el. |
|
|
;;;###autoload |
|
|
(defun grep-tag-default () |
|
|
(save-excursion |
|
|
(while (looking-at "\\sw\\|\\s_") |
|
|
(forward-char 1)) |
|
|
(when (or (re-search-backward "\\sw\\|\\s_" |
|
|
(save-excursion (beginning-of-line) (point)) |
|
|
t) |
|
|
(re-search-forward "\\(\\sw\\|\\s_\\)+" |
|
|
(save-excursion (end-of-line) (point)) |
|
|
t)) |
|
|
(goto-char (match-end 0)) |
|
|
(buffer-substring (point) |
|
|
(progn (forward-sexp -1) |
|
|
(while (looking-at "\\s'") |
|
|
(forward-char 1)) |
|
|
(point)))))) |
|
|
|
|
494 |
;;;###autoload |
;;;###autoload |
495 |
(defun grep-find (command-args) |
(defun grep-find (command-args) |
496 |
"Run grep via find, with user-specified args COMMAND-ARGS. |
"Run grep via find, with user-specified args COMMAND-ARGS. |