From 1c9935ff9784bb9c8d54405aa9308425aafb48fd Mon Sep 17 00:00:00 2001 From: Ranmocy Sheng Date: Mon, 21 Oct 2013 14:56:30 -0700 Subject: [PATCH] recompile elc instead of removing it when saving elisp file --- modules/prelude-emacs-lisp.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/prelude-emacs-lisp.el b/modules/prelude-emacs-lisp.el index d173e34..12ddba2 100644 --- a/modules/prelude-emacs-lisp.el +++ b/modules/prelude-emacs-lisp.el @@ -35,12 +35,12 @@ (require 'prelude-lisp) -(defun prelude-remove-elc-on-save () - "If you're saving an elisp file, likely the .elc is no longer valid." +(defun prelude-recompile-elc-on-save () + "Recompile your elc when saving an elisp file." (add-hook 'after-save-hook (lambda () - (if (file-exists-p (concat buffer-file-name "c")) - (delete-file (concat buffer-file-name "c")))) + (when (file-exists-p (byte-compile-dest-file buffer-file-name)) + (emacs-lisp-byte-compile))) nil t)) @@ -62,7 +62,7 @@ Start `ielm' if it's not already running." "Sensible defaults for `emacs-lisp-mode'." (run-hooks 'prelude-lisp-coding-hook) (turn-on-eldoc-mode) - (prelude-remove-elc-on-save) + (prelude-recompile-elc-on-save) (rainbow-mode +1) (setq mode-name "EL") (prelude-conditional-emacs-lisp-checker))