Permalink
Browse files

further emacs shaving

  • Loading branch information...
1 parent 60943c8 commit cb1a5f8f3ab123316e5bd21cd95d7b6de83ab20c Alan Dipert committed Apr 23, 2012
Showing with 25 additions and 9 deletions.
  1. +25 −9 init.el
View
34 init.el
@@ -57,19 +57,35 @@
hl-sexp))
(defun install-idempotent (name)
+ "Install package name unless already installed."
(when (not (package-installed-p name))
(package-install name)))
-(defun my-install (pkgs)
+(defun pkg-name (pkg)
+ "Given a pair or symbol, return a symbol."
+ (if (symbolp pkg) pkg (car pkg)))
+
+(defun install-stuff (pkgs)
+ "Spin through pkgs list and install every package."
+ (package-refresh-contents)
+ (dolist (pkg pkgs)
+ (install-idempotent (pkg-name pkg))))
+
+(defun config-stuff (pkgs)
+ "Spin through my pkgs list and run each configuration function."
(dolist (pkg pkgs)
- (if (symbolp pkg)
- (install-idempotent pkg)
- (let ((name (car pkg))
- (after (eval (cdr pkg))))
- (install-idempotent name)
- (funcall after)))))
-
-(my-install my-pkgs)
+ (when (not (symbolp pkg))
+ (funcall (eval (cdr pkg))))))
+
+(defun doit (pkgs)
+ "Install packages if they haven't been, and run their
+configuration lambdas."
+ (when (not (package-installed-p (pkg-name (last pkgs))))
+ (install-stuff pkgs))
+ (config-stuff pkgs))
+
+;;; doit
+(doit my-pkgs)
;;
;; visual settings

0 comments on commit cb1a5f8

Please sign in to comment.