Skip to content

Instantly share code, notes, and snippets.

@deadghost
Last active August 29, 2015 14:02
Show Gist options
  • Save deadghost/d9099537efecefcf9f04 to your computer and use it in GitHub Desktop.
Save deadghost/d9099537efecefcf9f04 to your computer and use it in GitHub Desktop.
Automatically download packages
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Dependencies ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'cl) ; Enable Common Lisp functions(Does not actually use CL)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Utility Functions ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun add-list-to-list (list1 list2)
"Same as add-to-list but takes a list of elements to add."
(mapcar (lambda (element) (add-to-list list1 element))
list2))
(defun add-hook-functions (hook func-list)
"Same as add-hook but takes a list of functions to add."
(mapcar (lambda (function) (add-hook hook function))
func-list))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Packages ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; std location for additonal per-user Emacs-specific files
(add-list-to-list 'load-path
'("~/.emacs.d/"
"~/.emacs.d/tern/emacs/"
"~/.emacs.d/sibilant/misc/"))
;;; include package archives via ELPA
(require 'package)
(package-initialize)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
;;; list of required packages
(setq packages '(
;; general
smart-tab ; tab completion
auto-complete
fill-column-indicator
elscreen
magit
helm
evil-leader
midnight ; periodically clean buffers
multi-term
;; desktop ; session management
smart-mode-line
idle-highlight-mode
ido-ubiquitous
;; ERC
erc-hl-nicks
smex
;; vim
evil
undo-tree ; vim style undo
key-chord ; required for ;; to ; evil mapping
evil-nerd-commenter
surround
;; eye candy
color-theme-solarized
rainbow-delimiters ; rainbow paren
nyan-mode ; nyan cat file percentage
;; lisp
slime
ac-slime ; slime auto-complete
paredit
evil-paredit
;; clojure
clojure-mode
clojure-test-mode
cider ; clojure IDE and REPL
;; extra language support
web-mode
markdown-mode
;sass-mode
;scss-mode
;; syntax checking
;flymake
;flymake-css
;flymake-sass
;; git
git-commit-mode
git-rebase-mode
gitconfig-mode
gitignore-mode
gitattributes-mode
))
(defun packages-installed-p ()
"Installs and updates required packages"
(loop for pkg in packages
when (not (package-installed-p pkg)) do (return nil)
finally (return t)))
(unless (packages-installed-p)
(message "%s" "Refreshing package database...")
(package-refresh-contents)
(dolist (pkg packages)
(when (not (package-installed-p pkg))
(package-install pkg))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment