summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-01-15 22:41:15 -0500
committerKyle Meyer <kyle@kyleam.com>2015-01-15 22:41:15 -0500
commit74aa350f0ba0be8827f63c998dd6e483f892e299 (patch)
treeea540807935cb93feae958f8408d697c72a81c9c
parent70f09a22308aa073970f0fdbfc9d0f21c137d98b (diff)
downloademacs.d-74aa350f0ba0be8827f63c998dd6e483f892e299.tar.gz
Use grep-setup-hook to hide grep headers
-rw-r--r--lisp/init-buffile.el19
1 files changed, 5 insertions, 14 deletions
diff --git a/lisp/init-buffile.el b/lisp/init-buffile.el
index 33fa74d..c26c323 100644
--- a/lisp/init-buffile.el
+++ b/lisp/init-buffile.el
@@ -71,21 +71,12 @@ The search is limited to file names matching shell pattern FILES.
FILES may use abbreviations defined in `grep-files-aliases', e.g.
entering `ch' is equivalent to `*.[ch]'.")
-;; http://stackoverflow.com/questions/16122801/
-;; remove-header-information-from-rgrep-grep-output-in-emacs
-(defun hide-grep-header ()
+(defun km/grep-hide-header ()
(save-excursion
- (with-current-buffer grep-last-buffer
- (goto-line 5)
- (narrow-to-region (point) (point-max)))))
-
-(after 'grep
- (defadvice grep (after hide-grep-header activate) (hide-grep-header))
- (defadvice rgrep (after hide-grep-header activate) (hide-grep-header))
- (defadvice lgrep (after hide-grep-hxoeader activate) (hide-grep-header))
- (defadvice grep-find (after hide-grep-header activate) (hide-grep-header)))
-(after 'vc-git
- (defadvice vc-git-grep (after hide-grep-header activate) (hide-grep-header)))
+ (goto-char (point-min))
+ (forward-line 4)
+ (narrow-to-region (point) (point-max))))
+(add-hook 'grep-setup-hook 'km/grep-hide-header)
(key-chord-define-global ",z" 'rgrep)