Refactor bootstrap

This commit is contained in:
Henrik Lissner 2016-02-26 17:58:42 -05:00
parent f13fe405ee
commit 5e35ef1ee2

View file

@ -49,36 +49,33 @@
(push file result))) (push file result)))
result))) result)))
;; Scan various folders to populate the load-paths (defvar narf--load-path load-path)
(defun narf/reload () (defun narf/reload ()
(interactive) (interactive)
(setq custom-theme-load-path
(eval-when-compile
(append (--subdirs (concat narf-private-dir "themes/"))
custom-theme-load-path)))
(setq load-path (setq load-path
(eval-when-compile (progn (require 'cask)
(require 'cask) (cask-initialize)
(cask-initialize) (append (list narf-private-dir)
(setq load-path (append (list narf-private-dir) (--subdirs narf-core-dir t)
(--subdirs narf-core-dir t) (--subdirs narf-modules-dir t)
(--subdirs narf-modules-dir t) (--subdirs narf-packages-dir)
(--subdirs narf-packages-dir) narf--load-path))))
load-path)))))
(narf/reload)
(defun narf (packages) (defun narf (packages)
"Bootstrap NARF emacs and initialize PACKAGES" "Bootstrap NARF emacs and initialize PACKAGES"
;; prematurely optimize for faster startup ;; prematurely optimize for faster startup
(let (file-name-handler-alist (let (file-name-handler-alist
(gc-cons-threshold 169715200)) (gc-cons-threshold 169715200))
;; Scan various folders to populate the load-paths
(setq custom-theme-load-path
(append (list (expand-file-name "themes/" narf-private-dir))
custom-theme-load-path)
load-path (eval-when-compile (narf/reload)))
;; Load local settings, if available ;; Load local settings, if available
(when (file-exists-p "~/.emacs.local.el") (when (file-exists-p "~/.emacs.local.el")
(load "~/.emacs.local.el")) (load "~/.emacs.local.el"))
(load-theme narf-theme t) (load-theme narf-theme t)
(setq narf-current-theme narf-theme) (setq narf-current-theme narf-theme)
(mapc 'require packages))) (mapc 'require packages)))
;;; bootstrap.el ends here ;;; bootstrap.el ends here