From 5519ad0069672c189f9c75577cb68f6512e6ce90 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 6 Jun 2014 21:51:41 -0400 Subject: Use milkypostman's `after' macro --- lisp/init-ace.el | 4 ++-- lisp/init-bib.el | 6 +++--- lisp/init-dired.el | 4 ++-- lisp/init-elisp.el | 13 ++++++------- lisp/init-general.el | 8 ++++++++ lisp/init-org.el | 39 +++++++++++++++++++-------------------- lisp/init-tex.el | 4 ++-- lisp/init-view.el | 11 +++++------ 8 files changed, 47 insertions(+), 42 deletions(-) diff --git a/lisp/init-ace.el b/lisp/init-ace.el index 9714a90..c33a8b2 100644 --- a/lisp/init-ace.el +++ b/lisp/init-ace.el @@ -8,8 +8,8 @@ (ace-link-setup-default) -(eval-after-load 'org - '(define-key org-mode-map (kbd "C-c m o") 'ace-link-org)) +(after 'org + (define-key org-mode-map (kbd "C-c m o") 'ace-link-org)) (define-key window-map "a" 'ace-window) (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) diff --git a/lisp/init-bib.el b/lisp/init-bib.el index 091b82a..4ae4ffe 100644 --- a/lisp/init-bib.el +++ b/lisp/init-bib.el @@ -8,9 +8,9 @@ (setq bibtex-align-at-equal-sign t) ; Used by `bibtex-fill-entry'. -(eval-after-load 'bibtex - '(setq bibtex-entry-format - (append '(realign sort-fields) bibtex-entry-format))) +(after 'bibtex + (setq bibtex-entry-format + (append '(realign sort-fields) bibtex-entry-format))) (defvar km/bibtex-unimportant-title-words '("a" "aboard" "about" "above" "absent" "across" "after" "against" diff --git a/lisp/init-dired.el b/lisp/init-dired.el index 63f5a98..4b59704 100644 --- a/lisp/init-dired.el +++ b/lisp/init-dired.el @@ -56,8 +56,8 @@ (yes-or-no-p (format "Open %s files?" num-files))) (-each files 'org-open-file)))) -(eval-after-load 'org +(after 'org ;; This overrides `dired-find-file', which is also bound to "f". - '(define-key dired-mode-map "e" 'km/org-open-dired-marked-files)) + (define-key dired-mode-map "e" 'km/org-open-dired-marked-files)) (provide 'init-dired) diff --git a/lisp/init-elisp.el b/lisp/init-elisp.el index 4a7750f..bcc6b77 100644 --- a/lisp/init-elisp.el +++ b/lisp/init-elisp.el @@ -6,12 +6,11 @@ (add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode) -(eval-after-load 'paredit - '(progn - (define-key paredit-mode-map (kbd "C-,") 'paredit-forward-slurp-sexp) - (define-key paredit-mode-map (kbd "C-.") 'paredit-forward-barf-sexp) - (define-key paredit-mode-map (kbd "C-M-,") 'paredit-backward-slurp-sexp) - (define-key paredit-mode-map (kbd "C-M-.") 'paredit-backward-barf-sexp) - (diminish 'paredit-mode "Pe"))) +(after 'paredit + (define-key paredit-mode-map (kbd "C-,") 'paredit-forward-slurp-sexp) + (define-key paredit-mode-map (kbd "C-.") 'paredit-forward-barf-sexp) + (define-key paredit-mode-map (kbd "C-M-,") 'paredit-backward-slurp-sexp) + (define-key paredit-mode-map (kbd "C-M-.") 'paredit-backward-barf-sexp) + (diminish 'paredit-mode "Pe")) (provide 'init-elisp) diff --git a/lisp/init-general.el b/lisp/init-general.el index 6d0efdb..3a2ef35 100644 --- a/lisp/init-general.el +++ b/lisp/init-general.el @@ -50,4 +50,12 @@ (global-set-key (kbd "C-c j") 'imenu) +;; Taken from +;; http://milkbox.net/note/single-file-master-emacs-configuration/. +(defmacro after (mode &rest body) + "`eval-after-load' MODE evaluate BODY." + (declare (indent defun)) + `(eval-after-load ,mode + '(progn ,@body))) + (provide 'init-general) diff --git a/lisp/init-org.el b/lisp/init-org.el index dd2ebe2..19e78eb 100644 --- a/lisp/init-org.el +++ b/lisp/init-org.el @@ -76,26 +76,25 @@ ("i" "#+index: ?" "#+index: ?") ("I" "#+include: %file ?" ""))) -(eval-after-load 'org - '(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) - ;; Override global `imenu' binding. - (define-key org-mode-map (kbd "C-c j") 'org-goto) - ;; Don't let `org-cycle-agenda-files' binding override custom - ;; `backward-kill-word' binding (`org-cycle-agenda-files' is still bound - ;; to C-,). - (define-key org-mode-map (kbd "C-'") nil) - ;; Rebind `org-insert-drawer' to so that `org-metadown' has the - ;; expected "C-c C-x" keybinding. - (define-key org-mode-map (kbd "C-c C-x d") 'org-metadown) - (define-key org-mode-map (kbd "C-c C-x w") 'org-insert-drawer) - ;; Avoid conflict when amsmath is loaded. - (setcar (rassoc '("wasysym" t) org-latex-default-packages-alist) - "nointegrals") - (add-to-list 'org-latex-packages-alist '("" "amsmath" t)))) +(after 'org + (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) + ;; Override global `imenu' binding. + (define-key org-mode-map (kbd "C-c j") 'org-goto) + ;; Don't let `org-cycle-agenda-files' binding override custom + ;; `backward-kill-word' binding (`org-cycle-agenda-files' is still bound + ;; to C-,). + (define-key org-mode-map (kbd "C-'") nil) + ;; Rebind `org-insert-drawer' to so that `org-metadown' has the + ;; expected "C-c C-x" keybinding. + (define-key org-mode-map (kbd "C-c C-x d") 'org-metadown) + (define-key org-mode-map (kbd "C-c C-x w") 'org-insert-drawer) + ;; Avoid conflict when amsmath is loaded. + (setcar (rassoc '("wasysym" t) org-latex-default-packages-alist) + "nointegrals") + (add-to-list 'org-latex-packages-alist '("" "amsmath" t))) (add-to-list 'auto-mode-alist '("\\.org.txt$" . org-mode)) diff --git a/lisp/init-tex.el b/lisp/init-tex.el index e7e79c6..8d72162 100644 --- a/lisp/init-tex.el +++ b/lisp/init-tex.el @@ -72,8 +72,8 @@ The point should be beyond \"\\section\"." (error "%s does not exist" pdf-file)) (start-process "tex-pdf" nil "xdg-open" pdf-file))) -(eval-after-load 'latex - '(define-key LaTeX-mode-map (kbd "C-c m p") 'km/latex-find-pdf)) +(after 'latex + (define-key LaTeX-mode-map (kbd "C-c m p") 'km/latex-find-pdf)) (eval-after-load 'reftex '(diminish 'reftex-mode "Rf")) diff --git a/lisp/init-view.el b/lisp/init-view.el index 74b3b08..424f2df 100644 --- a/lisp/init-view.el +++ b/lisp/init-view.el @@ -2,11 +2,10 @@ (setq view-read-only t) -(eval-after-load 'view - '(progn - (define-key view-mode-map "l" 'recenter-top-bottom) - (define-key view-mode-map "a" 'ace-jump-mode) - (define-key view-mode-map "j" 'imenu) - (diminish 'view-mode "Vw"))) +(after 'view + (define-key view-mode-map "l" 'recenter-top-bottom) + (define-key view-mode-map "a" 'ace-jump-mode) + (define-key view-mode-map "j" 'imenu) + (diminish 'view-mode "Vw")) (provide 'init-view) -- cgit v1.2.3