summaryrefslogtreecommitdiffstats
path: root/lisp/init-grep.el
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2017-05-31 20:57:41 +0200
committerMartin Polden <mpolden@mpolden.no>2017-05-31 20:57:41 +0200
commit3cb44c0ba3f74639ad1abde5cf77292825fdd378 (patch)
tree3ca5b7418e7acf6a1308cce57b188f0c2b2e2be9 /lisp/init-grep.el
parentd768b60ac1af853eaeb628a5facb26f5139d13f2 (diff)
Do not use :config to declare functions
Diffstat (limited to 'lisp/init-grep.el')
-rw-r--r--lisp/init-grep.el38
1 files changed, 19 insertions, 19 deletions
diff --git a/lisp/init-grep.el b/lisp/init-grep.el
index 84ea710..934ba7c 100644
--- a/lisp/init-grep.el
+++ b/lisp/init-grep.el
@@ -1,28 +1,28 @@
+(defun grep-visit-buffer-other-window (&optional event noselect)
+ "Visit grep result in another window."
+ (interactive)
+ (let ((current-window (selected-window)))
+ (compile-goto-error event)
+ (when noselect
+ (select-window current-window))))
+
+(defun grep-visit-buffer-other-window-noselect (&optional event)
+ "Visit grep result in another window, but don't select it."
+ (interactive)
+ (grep-visit-buffer-other-window event t))
+
(use-package grep
:ensure nil ;; package is bundled with emacs
:bind (:map grep-mode-map
- ;; make C-o and o behave as in dired
- ("o" . grep-visit-buffer-other-window)
- ("C-o" . grep-visit-buffer-other-window-noselect)
- ;; n and p changes line as in ag-mode
- ("n" . compilation-next-error)
- ("p" . compilation-previous-error))
+ ;; make C-o and o behave as in dired
+ ("o" . grep-visit-buffer-other-window)
+ ("C-o" . grep-visit-buffer-other-window-noselect)
+ ;; n and p changes line as in ag-mode
+ ("n" . compilation-next-error)
+ ("p" . compilation-previous-error))
:config
- (defun grep-visit-buffer-other-window (&optional event noselect)
- "Visit grep result in another window."
- (interactive)
- (let ((current-window (selected-window)))
- (compile-goto-error event)
- (when noselect
- (select-window current-window))))
-
- (defun grep-visit-buffer-other-window-noselect (&optional event)
- "Visit grep result in another window, but don't select it."
- (interactive)
- (grep-visit-buffer-other-window event t))
-
(add-hook 'grep-mode-hook
(lambda ()
;; wrap lines