Mercurial > emacs
comparison lisp/progmodes/grep.el @ 65126:559a37c2f306
(grep, grep-mode): Make buffer-local variables
compilation-process-setup-function and compilation-disable-input
in grep-mode instead of let-bindings in grep.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Thu, 25 Aug 2005 19:09:22 +0000 |
parents | fb6294015f51 |
children | 6b7109ed93a0 2d92f5c9d6ae |
comparison
equal
deleted
inserted
replaced
65125:bb897fec166c | 65126:559a37c2f306 |
---|---|
285 '(;; Command output lines. | 285 '(;; Command output lines. |
286 ("^\\([A-Za-z_0-9/\.+-]+\\)[ \t]*:" 1 font-lock-function-name-face) | 286 ("^\\([A-Za-z_0-9/\.+-]+\\)[ \t]*:" 1 font-lock-function-name-face) |
287 (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$" | 287 (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$" |
288 1 grep-error-face) | 288 1 grep-error-face) |
289 ;; remove match from grep-regexp-alist before fontifying | 289 ;; remove match from grep-regexp-alist before fontifying |
290 ("^Grep started.*" (0 '(face nil message nil help-echo nil mouse-face nil) t)) | 290 ("^Grep started.*" |
291 (0 '(face nil message nil help-echo nil mouse-face nil) t)) | |
291 ("^Grep finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*" | 292 ("^Grep finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*" |
292 (0 '(face nil message nil help-echo nil mouse-face nil) t) | 293 (0 '(face nil message nil help-echo nil mouse-face nil) t) |
293 (1 compilation-info-face nil t) | 294 (1 compilation-info-face nil t) |
294 (2 compilation-warning-face nil t)) | 295 (2 compilation-warning-face nil t)) |
295 ("^Grep \\(exited abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code \\([0-9]+\\)\\)?.*" | 296 ("^Grep \\(exited abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code \\([0-9]+\\)\\)?.*" |
515 nil nil 'grep-history | 516 nil nil 'grep-history |
516 (if current-prefix-arg nil default)))))) | 517 (if current-prefix-arg nil default)))))) |
517 | 518 |
518 ;; Setting process-setup-function makes exit-message-function work | 519 ;; Setting process-setup-function makes exit-message-function work |
519 ;; even when async processes aren't supported. | 520 ;; even when async processes aren't supported. |
520 (let ((compilation-process-setup-function 'grep-process-setup) | 521 (compilation-start (if (and grep-use-null-device null-device) |
521 (compilation-disable-input t)) | 522 (concat command-args " " null-device) |
522 (compilation-start (if (and grep-use-null-device null-device) | 523 command-args) |
523 (concat command-args " " null-device) | 524 'grep-mode nil highlight-regexp)) |
524 command-args) | |
525 'grep-mode nil highlight-regexp))) | |
526 | 525 |
527 ;;;###autoload | 526 ;;;###autoload |
528 (define-compilation-mode grep-mode "Grep" | 527 (define-compilation-mode grep-mode "Grep" |
529 "Sets `grep-last-buffer' and `compilation-window-height'." | 528 "Sets `grep-last-buffer' and `compilation-window-height'." |
530 (setq grep-last-buffer (current-buffer)) | 529 (setq grep-last-buffer (current-buffer)) |
531 (set (make-local-variable 'compilation-error-face) | 530 (set (make-local-variable 'compilation-error-face) |
532 grep-hit-face) | 531 grep-hit-face) |
533 (set (make-local-variable 'compilation-error-regexp-alist) | 532 (set (make-local-variable 'compilation-error-regexp-alist) |
534 grep-regexp-alist) | 533 grep-regexp-alist) |
534 (set (make-local-variable 'compilation-process-setup-function) | |
535 'grep-process-setup) | |
536 (set (make-local-variable 'compilation-disable-input) t) | |
535 ;; Set `font-lock-lines-before' to 0 to not refontify the previous | 537 ;; Set `font-lock-lines-before' to 0 to not refontify the previous |
536 ;; line where grep markers may be already removed. | 538 ;; line where grep markers may be already removed. |
537 (set (make-local-variable 'font-lock-lines-before) 0)) | 539 (set (make-local-variable 'font-lock-lines-before) 0)) |
538 | 540 |
539 ;;;###autoload | 541 ;;;###autoload |