Browse files

Merge pull request #108 from DarwinAwardWinner/patch-2

Load system and user config files after init. Should help with #107.
  • Loading branch information...
2 parents 74b7ef9 + b1fd4fc commit 5efa136c2ffced48fb5a25948e92ea11b850cedb @technomancy committed Nov 14, 2011
Showing with 15 additions and 4 deletions.
  1. +15 −4 starter-kit.el
View
19 starter-kit.el
@@ -57,10 +57,21 @@
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
- (when (file-exists-p esk-system-config) (load esk-system-config))
- (when (file-exists-p esk-user-config) (load esk-user-config))
- (when (file-exists-p esk-user-dir)
- (mapc 'load (directory-files esk-user-dir nil "^[^#].*el$"))))
+ (defun esk-eval-after-init (form)
+ "Add `(lambda () FORM)' to `after-init-hook'.
+
+ If Emacs has already finished initialization, also eval FORM immediately."
+ (let ((func (list 'lambda nil form)))
+ (add-hook 'after-init-hook func)
+ (when after-init-time
+ (eval form))))
+
+ (esk-eval-after-init
+ '(progn
+ (when (file-exists-p esk-system-config) (load esk-system-config))
+ (when (file-exists-p esk-user-config) (load esk-user-config))
+ (when (file-exists-p esk-user-dir)
+ (mapc 'load (directory-files esk-user-dir nil "^[^#].*el$"))))))
(provide 'starter-kit)
;;; starter-kit.el ends here

0 comments on commit 5efa136

Please sign in to comment.