diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -1,5 +1,26 @@ -(let ((file-name-handler-alist nil)) - (package-initialize nil) - (setq package-enable-at-startup nil - org-babel-use-quick-and-dirty-noweb-expansion t) - (org-babel-load-file "~/.emacs.d/init.d/main.org")) +(setq alex/startup-time (current-time) + alex/config (concat user-emacs-directory "init.d/main.org")) + +(defun alex/untangle-file-name (file) + (let ((base (file-name-sans-extension file))) + (concat base ".el"))) + +(defun alex/tangle-config (orgfile elfile) + (let ((org-babel-use-quick-and-dirty-noweb-expansion t)) + (message "Generating %s from %s. This may need some time..." elfile orgfile) + (let ((inhibit-message t)) + (require 'org) + (org-babel-tangle-file orgfile elfile 'emacs-lisp)) + (message "Done."))) + +(let ((elfile (alex/untangle-file-name alex/config))) + (when (or (not (file-exists-p elfile)) + (file-newer-than-file-p alex/config elfile)) + (alex/tangle-config alex/config elfile)) + + (let ((file-name-handler-alist nil)) + (package-initialize nil) + (setq package-enable-at-startup nil) + (load-file elfile))) + +(message "Startup finished in %.2fs" (float-time (time-subtract (current-time) alex/startup-time))) |