about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.emacs.d/lisp/init-emacs-lisp.el21
1 files changed, 9 insertions, 12 deletions
diff --git a/.emacs.d/lisp/init-emacs-lisp.el b/.emacs.d/lisp/init-emacs-lisp.el
index ed608c3..7bc2ac5 100644
--- a/.emacs.d/lisp/init-emacs-lisp.el
+++ b/.emacs.d/lisp/init-emacs-lisp.el
@@ -13,19 +13,16 @@
   :diminish)
 
 (use-package emacs
-  :ensure nil
   :config
-  ;; From prelude-emacs-lisp.el
-  (defun recompile-elc-on-save ()
+  ;; Based on prelude-emacs-lisp.el
+  (defun recompile-init-lisp ()
+    (when (and
+           (string-prefix-p (expand-file-name "lisp" user-emacs-directory) (file-truename buffer-file-name))
+           (file-exists-p (byte-compile-dest-file buffer-file-name)))
+      (emacs-lisp-byte-compile)))
+  (defun recompile-init-lisp-on-save ()
     "Recompile your elc when saving an elisp file. (Adds buffer-local hook)"
-    (add-hook 'after-save-hook
-              (lambda ()
-                (when (and
-                       (string-prefix-p user-emacs-directory (file-truename buffer-file-name))
-                       (file-exists-p (byte-compile-dest-file buffer-file-name)))
-                  (emacs-lisp-byte-compile)))
-              nil
-              t))
+    (add-hook 'after-save-hook 'recompile-init-lisp nil t))
   ;; From prelude-emacs-lisp.el
   (defun visit-ielm ()
     "Switch to default `ielm' buffer.
@@ -41,7 +38,7 @@ Start `ielm' if it's not already running."
                        (rainbow-mode +1)
                        (rainbow-delimiters-mode +1)
                        (setq mode-name "EL")
-                       (recompile-elc-on-save)))
+                       (recompile-init-lisp-on-save)))
   :bind
   (:map emacs-lisp-mode-map
         (("C-c C-z" . visit-ielm)