From 317dc6b44ce94aae3dafbb3defc855b36b69c32f Mon Sep 17 00:00:00 2001 From: Kashish Sharma Date: Tue, 14 Jun 2016 03:30:26 +0530 Subject: [PATCH] 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 --- .gitignore | 3 ++- contrapunctus/cp-lisp.el | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index aa1fd6a..a79fb0c 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -*~ +*~ erc/logs/ elpa/*readme.txt elpa/ elisp-git/ +*elc \ No newline at end of file diff --git a/contrapunctus/cp-lisp.el b/contrapunctus/cp-lisp.el index d006700..afb15c4 100644 --- a/contrapunctus/cp-lisp.el +++ b/contrapunctus/cp-lisp.el @@ -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)