forked from magnars/.emacs.d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-package.el
30 lines (24 loc) · 993 Bytes
/
setup-package.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(require 'package)
(defvar marmalade '("marmalade" . "http://marmalade-repo.org/packages/"))
(defvar gnu '("gnu" . "http://elpa.gnu.org/packages/"))
(defvar melpa '("melpa" . "http://melpa.milkbox.net/packages/"))
;; Add marmalade to package repos
(add-to-list 'package-archives marmalade)
(add-to-list 'package-archives melpa t)
(package-initialize)
(unless (and (file-exists-p "~/.emacs.d/elpa/archives/marmalade")
(file-exists-p "~/.emacs.d/elpa/archives/gnu")
(file-exists-p "~/.emacs.d/elpa/archives/melpa"))
(package-refresh-contents))
(defun packages-install (&rest packages)
(mapc (lambda (package)
(let ((name (car package))
(repo (cdr package)))
(when (not (package-installed-p name))
(let ((package-archives (list repo)))
(package-initialize)
(package-install name)))))
packages)
(package-initialize)
(delete-other-windows))
(provide 'setup-package)