Skip to content

Commit

Permalink
Added auto installation for packages in Emacs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Judson committed Jul 7, 2015
1 parent 2a19de2 commit e8fb1ec
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions dotfiles/.emacs.d/init.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@
("melpa" . "http://melpa.org/packages/")))

(package-initialize)
(setq my-packages
(set-difference
'(bracketed-paste
cider
clojure-mode
csv-mode
expand-region
flycheck
jedi
magit
multiterm
zenburn-theme
)
'(melpa)
)
)

(defun my-packages-installed-p ()
(loop for p in my-packages
when (not (package-installed-p p)) do (return nil)
finally (return t)))

(when (and ;;(not (getenv "http_proxy")) might not be necessary in most situations, can readd
(not (my-packages-installed-p)))
;; check for new packages (package versions)
(message "%s" "Emacs is now refreshing its package database...")
(package-refresh-contents)
(message "%s" " done.")
;; install the missing packages
(dolist (p my-packages)
(when (not (package-installed-p p))
(condition-case nil
(package-install p)
(error (message "%s not installable" p))))))
;; TODO: add autoinstallation of necessary Pip modules for Python modes

;;
(require 'multi-term)
;; copy paste into terminal easier
(require 'bracketed-paste)
Expand All @@ -15,6 +52,7 @@
(require 'magit)
(require 'csv-mode)
(require 'clojure-mode)
(require 'cider)
(require 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)
;;python related stuff
Expand Down

0 comments on commit e8fb1ec

Please sign in to comment.