Skip to content

Instantly share code, notes, and snippets.

Created July 3, 2011 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1061884 to your computer and use it in GitHub Desktop.
Save anonymous/1061884 to your computer and use it in GitHub Desktop.
(defun auto-byte-recompile ()
"If the current buffer is in emacs-lisp-mode and there already exists an `.elc'
file corresponding to the current buffer file, then recompile the file."
(interactive)
(when (and (eq major-mode 'emacs-lisp-mode)
(file-exists-p (byte-compile-dest-file buffer-file-name)))
(byte-compile-file buffer-file-name)))
(add-hook 'after-save-hook 'auto-byte-recompile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment