From 62ba0f0413af60d0554cdda83af4741b792bb0e4 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 21 Jun 2016 22:35:37 -0700 Subject: [PATCH] Set up automatic compilation of emacs-lisp We set the load-prefer-newer in init.el, so automatic compilation should be relatively safe. Still worth looking out for any issues this commit might cause. --- dotfiles/emacs.d/README.org | 14 ++++++++++++++ dotfiles/emacs.d/init.el | 3 +++ 2 files changed, 17 insertions(+) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 06402eac..7575ce17 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -15,6 +15,20 @@ This makes it so that the file that is produced from tangling this file uses lex (replace-regexp-in-string "\n$" "" (shell-command-to-string "git config --get user.email"))) #+END_SRC +** auto-compile +This is here because it needs to be activated as early as possible +#+BEGIN_SRC emacs-lisp + (use-package auto-compile + :config + (progn + (auto-compile-on-load-mode) + (auto-compile-on-save-mode))) +#+END_SRC +** Prefer Newer Versions +To reduce the risk of loading outdated byte code files, we set load-prefer-newer and enable auto-compile-on-load-mode as early as possible. +#+BEGIN_SRC emacs-lisp + (setq load-prefer-newer t) +#+END_SRC ** Custom Files It's annoying to have emacs randomly add stuff to your init.el whenever you customize a variable. By setting a custom file other than init.el that is ignored in git, random commits with nothing but variable settings are avoided. diff --git a/dotfiles/emacs.d/init.el b/dotfiles/emacs.d/init.el index 32a6ffb0..a5f493fa 100644 --- a/dotfiles/emacs.d/init.el +++ b/dotfiles/emacs.d/init.el @@ -1,6 +1,9 @@ +;; -*- no-byte-compile: t -*- (require 'package) (package-initialize) +(setq load-prefer-newer t) + (setq custom-file "~/.emacs.d/custom-before.el") (when (file-exists-p custom-file) (load custom-file))