cp-lisp.el - auto-compile-on-save code for elisp

emacs-init-time to open a session showing (only) the *Messages* buffer -
before (no byte-compilation)   - 13.1s
after  (with byte-compilation) - 12.7s
This commit is contained in:
Kashish Sharma 2016-06-14 03:30:26 +05:30
parent f8fe50bd38
commit 317dc6b44c
2 changed files with 10 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
*~
*~
erc/logs/
elpa/*readme.txt
elpa/
elisp-git/
*elc

View File

@ -33,3 +33,11 @@
:keymap geiser-mode-map
:bindings
`((,(kbd "C-.")))))
(autoload 'byte-recompile-file "bytecomp" "byte-recompile-file" t)
(defun cp-byte-recompile-el-buffer ()
"Run byte-recompile-file on current buffer if current buffer is
an Emacs Lisp file."
(if (equal major-mode 'emacs-lisp-mode)
(byte-compile-file (buffer-name))))
(add-hook 'after-save-hook 'cp-byte-recompile-el-buffer)