summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-06-02 23:52:28 +0200
committerGravatar Tom Willemse2014-06-02 23:52:28 +0200
commit85e350cd54afeb44302f32178a60f4950ef4c858 (patch)
tree622ed816701b662fa06a957739cb437e6c2a3ca8
parentb0da2bf32612893c28ac4a21aa1e77373fe841d4 (diff)
downloademacs-85e350cd54afeb44302f32178a60f4950ef4c858.tar.gz
emacs-85e350cd54afeb44302f32178a60f4950ef4c858.zip
Add auto-init macro
-rw-r--r--.emacs.d/init.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index a0534af..8ee6b79 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -38,6 +38,16 @@
;;;; Macros
+(defmacro auto-init (library)
+ "Load a file for LIBRARY after loading the library.
+
+The loaded file should be `LIBRARY-init', either `.el' or `.elc'
+will do."
+ `(with-eval-after-load ',library
+ (load ,(concat (if (symbolp library)
+ (symbol-name library)
+ library) "-init"))))
+
;; http://www.lunaryorn.com/2013/06/25/introducing-with-eval-after-load/
(defmacro stante-after (feature &rest forms)
"After FEATURE is loaded, evaluate FORMS.