Permalink
Browse files

Load system and user config files after init. Should help with #107.

ALMOST ENTIRELY UNTESTED.
  • Loading branch information...
1 parent 74b7ef9 commit b1fd4fc50e2e5df674e766afe49d2cbd36de4595 @DarwinAwardWinner DarwinAwardWinner committed Nov 15, 2011
Showing with 15 additions and 4 deletions.
  1. +15 −4 starter-kit.el
View
@@ -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 b1fd4fc

Please sign in to comment.