This is what the buffer looks like when I run rgrep
. I'd like to just see my results--all the other information is meaningless to me.
-*- mode: grep; default-directory: "~/.emacs/" -*-
Grep started at Sat Jan 20 12:42:21
grep --exclude=.\#\* --exclude=\*.o --exclude=\*\~ --exclude=\*.bin --exclude=\*.lbin --exclude=\*.so --exclude=\*.a --exclude=\*.ln --exclude=\*.blg --exclude=\*.bbl --exclude=\*.elc --exclude=\*.lof --exclude=\*.glo --exclude=\*.idx --exclude=\*.lot --exclude=\*.fmt --exclude=\*.tfm --exclude=\*.class --exclude=\*.fas --exclude=\*.lib --exclude=\*.mem --exclude=\*.x86f --exclude=\*.sparcf --exclude=\*.dfsl --exclude=\*.pfsl --exclude=\*.d64fsl --exclude=\*.p64fsl --exclude=\*.lx64fsl --exclude=\*.lx32fsl --exclude=\*.dx64fsl --exclude=\*.dx32fsl --exclude=\*.fx64fsl --exclude=\*.fx32fsl --exclude=\*.sx64fsl --exclude=\*.sx32fsl --exclude=\*.wx64fsl --exclude=\*.wx32fsl --exclude=\*.fasl --exclude=\*.ufsl --exclude=\*.fsl --exclude=\*.dxl --exclude=\*.lo --exclude=\*.la --exclude=\*.gmo --exclude=\*.mo --exclude=\*.toc --exclude=\*.aux --exclude=\*.cp --exclude=\*.fn --exclude=\*.ky --exclude=\*.pg --exclude=\*.tp --exclude=\*.vr --exclude=\*.cps --exclude=\*.fns --exclude=\*.kys --exclude=\*.pgs --exclude=\*.tps --exclude=\*.vrs --exclude=\*.pyc --exclude=\*.pyo -i -nH -e grep *.el
init.el:236:(global-set-key (kbd "s-f") 'rgrep)
init.el:237:(global-set-key (kbd "C-f") 'lgrep)
Grep finished (matches found) at Sat Jan 20 12:42:21
The header insert is buried within a call to compilation-start
deep within rgrep
. There's not a simple way to keep these functions from inserting the header. But you can pretty easily hide the first four lines of the buffer by defining advice.
(defun delete-grep-header ()
(save-excursion
(with-current-buffer grep-last-buffer
(goto-line 5)
(narrow-to-region (point) (point-max)))))
(defadvice grep (after delete-grep-header activate) (delete-grep-header))
(defadvice rgrep (after delete-grep-header activate) (delete-grep-header))
You can later widen to reveal these lines again with C-xnw.
If you also want to advise lgrep
, grep-find
and zrgrep
, you can replace the defadvice
macros above with a programmatic advising like this:
(defvar delete-grep-header-advice
(ad-make-advice
'delete-grep-header nil t
'(advice lambda () (delete-grep-header))))
(defun add-delete-grep-header-advice (function)
(ad-add-advice function delete-grep-header-advice 'after 'first)
(ad-activate function))
(mapc 'add-delete-grep-header-advice
'(grep lgrep grep-find rgrep zrgrep))