David Anderson avatar David Anderson committed 05df943

More comments.

Comments (0)

Files changed (1)

-;; Initialize packages, then apply followup settings.
+;; Initialize packages, with just Melpa as a source.
 (require 'package)
 (setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/")))
-(add-hook 'after-init-hook #'(lambda () (load "~/.emacs.d/preferences.el")))
 (package-initialize)
 
-;; Some utilities. elisp is from the past, and doesn't have a filter
-;; function.
-(defun da-filter (condp lst)
-  (delq nil
-        (mapcar (lambda (x) (and (funcall condp x) x)) lst)))
-
+;; These are the packages that I want present on all machines.
 (setq da-desired-packages
       '(color-theme-approximate
         color-theme-solarized
         yaml-mode
         yasnippet))
 
+;; An implementation of filter, since elisp is from the past and
+;; doesn't have one.
+(defun da-filter (condp lst)
+  (delq nil
+        (mapcar (lambda (x) (and (funcall condp x) x)) lst)))
+
+;; Install missing packages before processing the rest of the
+;; preferences. Otherwise, the configuration will almost certainly
+;; fail to load.
 (let ((missing-packages (da-filter (lambda (x) (not (package-installed-p x))) da-desired-packages)))
   (when (not (null missing-packages))
     (if (y-or-n-p (format "Packages %s are missing. Install? " missing-packages))
         (progn
           (package-refresh-contents)
           (mapc 'package-install missing-packages)))))
+
+;; Finally, chain off to other settings, once all packages are
+;; available to autoload.
+(add-hook 'after-init-hook #'(lambda () (load "~/.emacs.d/preferences.el")))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.