From ff40eb32de1f0cf1cf668dd65b620d1b2deed1ac Mon Sep 17 00:00:00 2001
From: Kyle Meyer <kyle@kyleam.com>
Date: Mon, 28 Apr 2014 22:59:16 -0400
Subject: Move some hook bindings to mode maps

---
 lisp/init-org.el | 15 +++------------
 lisp/init-tex.el |  5 ++---
 2 files changed, 5 insertions(+), 15 deletions(-)

(limited to 'lisp')

diff --git a/lisp/init-org.el b/lisp/init-org.el
index f708b47..4002a89 100644
--- a/lisp/init-org.el
+++ b/lisp/init-org.el
@@ -77,6 +77,9 @@
   '(progn
      (define-key org-mode-map (kbd "C-c C-x B")
        'km/org-tree-to-indirect-buffer-current-window)
+     (define-key org-mode-map  (kbd "C-c m w") 'km/org-refile-to-other-org-buffer)
+     (define-key org-mode-map (kbd "C-c m s") 'km/org-sort-parent)
+     (define-key org-mode-map (kbd "C-c m o") 'ace-link-org)
      ;; Don't let `org-cycle-agenda-files' binding override custom
      ;; `backward-kill-word' binding (`org-cycle-agenda-files' is still bound
      ;; to C-,).
@@ -250,16 +253,4 @@ MAXLEVEL (defaults to 2)."
 
 (define-key ctl-x-4-map "o" 'km/org-switch-to-buffer-other-window)
 
-(eval-after-load 'org
-  '(add-to-list 'org-mode-hook
-                '(lambda ()
-                   (local-set-key (kbd "C-c m w")
-                                  'km/org-refile-to-other-org-buffer)
-                   (local-set-key (kbd "C-c m W")
-                                  'km/org-refile-to-other-file)
-                   (local-set-key (kbd "C-c m s")
-                                  'km/org-sort-parent)
-                   (local-set-key (kbd "C-c m o")
-                                  'ace-link-org))))
-
 (provide 'init-org)
diff --git a/lisp/init-tex.el b/lisp/init-tex.el
index 1eed85a..e7e79c6 100644
--- a/lisp/init-tex.el
+++ b/lisp/init-tex.el
@@ -72,9 +72,8 @@ The point should be beyond \"\\section\"."
       (error "%s does not exist" pdf-file))
     (start-process "tex-pdf" nil "xdg-open" pdf-file)))
 
-(add-hook 'LaTeX-mode-hook
-          '(lambda ()
-             (local-set-key (kbd "C-c m p") 'km/latex-find-pdf)))
+(eval-after-load 'latex
+  '(define-key LaTeX-mode-map (kbd "C-c m p") 'km/latex-find-pdf))
 
 (eval-after-load 'reftex
     '(diminish 'reftex-mode "Rf"))
-- 
cgit v1.2.3