emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

recompile and grep


From: Juri Linkov
Subject: recompile and grep
Date: Tue, 23 Aug 2005 22:38:06 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

grep-mode provides a menu item `Repeat grep' which is bound to
`recompile'.  But using `recompile' on grep buffers has two problems:

1. grep command repeated with `recompile' uses compilation exit messages
instead of grep exit messages (`matches found/no matches found') which
leads to incorrect fontification.

2. new variable `compilation-disable-input' is nil in grep buffers
when grep is started by `recompile'.  This is a minor problem but
it would be good to fix both problems with the following patch
which makes the variables `compilation-process-setup-function'
and `compilation-disable-input' buffer-local in grep buffers:

Index: lisp/progmodes/grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.47
diff -c -r1.47 grep.el
*** lisp/progmodes/grep.el      20 Aug 2005 21:47:40 -0000      1.47
--- lisp/progmodes/grep.el      23 Aug 2005 19:35:12 -0000
***************
*** 517,528 ****
  
    ;; Setting process-setup-function makes exit-message-function work
    ;; even when async processes aren't supported.
!   (let ((compilation-process-setup-function 'grep-process-setup)
!       (compilation-disable-input t))
!     (compilation-start (if (and grep-use-null-device null-device)
!                          (concat command-args " " null-device)
!                        command-args)
!                      'grep-mode nil highlight-regexp)))
  
  ;;;###autoload
  (define-compilation-mode grep-mode "Grep"
--- 532,541 ----
  
    ;; Setting process-setup-function makes exit-message-function work
    ;; even when async processes aren't supported.
!   (compilation-start (if (and grep-use-null-device null-device)
!                        (concat command-args " " null-device)
!                      command-args)
!                    'grep-mode nil highlight-regexp))
  
  ;;;###autoload
  (define-compilation-mode grep-mode "Grep"
***************
*** 532,537 ****
--- 545,553 ----
         grep-hit-face)
    (set (make-local-variable 'compilation-error-regexp-alist)
         grep-regexp-alist)
+   (set (make-local-variable 'compilation-process-setup-function)
+        'grep-process-setup)
+   (set (make-local-variable 'compilation-disable-input) t)
    ;; Set `font-lock-lines-before' to 0 to not refontify the previous
    ;; line where grep markers may be already removed.
    (set (make-local-variable 'font-lock-lines-before) 0))

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]