diff options
author | David Morgan <djm_uk@protonmail.com> | 2021-09-06 20:59:40 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2021-09-06 20:59:40 +0100 |
commit | fa5235f24286041496dc81379ff9b19d0994a65f (patch) | |
tree | 26ccab546fa36dcf6e687a6a4e81a8a5d1b77a90 | |
parent | ab2f5baad75e110f8628823dc725296f33d1582c (diff) | |
download | dotfiles-fa5235f24286041496dc81379ff9b19d0994a65f.tar.gz |
Fix recompile elisp hook
-rw-r--r-- | .emacs.d/lisp/init-emacs-lisp.el | 21 |
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) |