summaryrefslogblamecommitdiffstats
path: root/init.el
blob: 427291c063e1781a546e5c7ef8b81d62a221588c (plain) (tree)

























                                                                                                   
(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)))