summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/init-go.el17
-rw-r--r--lisp/init-grep.el14
-rw-r--r--lisp/init-ibuffer.el11
-rw-r--r--lisp/init-python.el20
4 files changed, 30 insertions, 32 deletions
diff --git a/lisp/init-go.el b/lisp/init-go.el
index 07141e1..499da78 100644
--- a/lisp/init-go.el
+++ b/lisp/init-go.el
@@ -23,15 +23,14 @@ items follow a style that is consistent with other prog-modes."
"Return a flat imenu index alist. See `go-mode-create-imenu-index'."
(apply 'nconc (mapcar 'cdr (go-mode-create-imenu-index))))
+(defun go-mode-buffer-local-variables ()
+ ;; adjust fill-column
+ (setq-local fill-column 120)
+ ;; use flat imenu index
+ (setq-local imenu-create-index-function
+ #'go-mode-create-flat-imenu-index))
+
(use-package go-mode
- :init
- :config
- (add-hook 'go-mode-hook
- (lambda ()
- ;; adjust fill-column
- (setq-local fill-column 120)
- ;; use flat imenu index
- (setq-local imenu-create-index-function
- #'go-mode-create-flat-imenu-index))))
+ :hook (go-mode . go-mode-buffer-local-variables))
(provide 'init-go)
diff --git a/lisp/init-grep.el b/lisp/init-grep.el
index 934ba7c..8b04c6e 100644
--- a/lisp/init-grep.el
+++ b/lisp/init-grep.el
@@ -11,21 +11,21 @@
(interactive)
(grep-visit-buffer-other-window event t))
+(defun grep-mode-buffer-local-variables ()
+ ;; wrap lines
+ (setq-local truncate-lines nil))
+
(use-package grep
:ensure nil ;; package is bundled with emacs
+ :hook (grep-mode . grep-mode-buffer-local-variables)
+
: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))
-
- :config
- (add-hook 'grep-mode-hook
- (lambda ()
- ;; wrap lines
- (setq-local truncate-lines nil))))
+ ("p" . compilation-previous-error)))
(provide 'init-grep)
diff --git a/lisp/init-ibuffer.el b/lisp/init-ibuffer.el
index 67aade4..4552b30 100644
--- a/lisp/init-ibuffer.el
+++ b/lisp/init-ibuffer.el
@@ -16,13 +16,12 @@
:map ibuffer-mode-map
;; make C-o and o behave as in dired
("o" . ibuffer-visit-buffer-other-window)
- ("C-o" . ibuffer-visit-buffer-other-window-noselect))
-
- :config
- ;; group ibuffer by projectile project
- (add-hook 'ibuffer-hook 'ibuffer-projectile-set-filter-groups))
+ ("C-o" . ibuffer-visit-buffer-other-window-noselect)))
(use-package ibuffer-projectile
- :after (ibuffer projectile))
+ :after (ibuffer projectile)
+
+ ;; group ibuffer by projectile project
+ :hook (ibuffer-mode . ibuffer-projectile-set-filter-groups))
(provide 'init-ibuffer)
diff --git a/lisp/init-python.el b/lisp/init-python.el
index d3ed060..ec6c741 100644
--- a/lisp/init-python.el
+++ b/lisp/init-python.el
@@ -1,16 +1,16 @@
+(defun python-mode-buffer-local-variables ()
+ ;; highlight lines longer than 88 characters
+ (setq-local fill-column 88)
+ ;; use flat index in imenu
+ (setq-local imenu-create-index-function
+ 'python-imenu-create-flat-index))
+
(use-package python
:ensure nil ;; package is bundled with emacs
-
+ :commands python-mode
+ :hook (python-mode . python-mode-buffer-local-variables)
:config
;; use flake8 as flymake backend
- (setq python-flymake-command '("flake8" "-"))
- ;; set buffer local variables
- (add-hook 'python-mode-hook
- (lambda ()
- ;; highlight lines longer than 88 characters
- (setq-local fill-column 88)
- ;; use flat index in imenu
- (setq-local imenu-create-index-function
- 'python-imenu-create-flat-index))))
+ (setq python-flymake-command '("flake8" "-")))
(provide 'init-python)