Last active
December 14, 2015 02:09
-
-
Save sabottenda/5011883 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'package) | |
;; package directory | |
(setq package-user-dir "~/local/common/emacs/package") | |
; Add package-archives | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
(package-initialize) | |
(defun my-package-install-from-url (url) | |
(switch-to-buffer (url-retrieve-synchronously url)) | |
(package-install-from-buffer (package-buffer-info) 'single)) | |
;; install melpa automatically | |
(when (not (package-installed-p 'melpa)) | |
(my-package-install-from-url "https://raw.github.com/milkypostman/melpa/master/melpa.el")) | |
; melpa.el | |
(require 'melpa) | |
(require 'cl) | |
(defvar installing-package-list | |
'( | |
php-mode | |
js2-mode | |
cperl-mode | |
python-mode | |
ruby-mode | |
)) | |
(defun install-package-if-not-installed (package-list) | |
(let ((not-installed (loop for x in package-list | |
when (not (package-installed-p x)) | |
collect x))) | |
(when not-installed | |
(package-refresh-contents) | |
(dolist (pkg not-installed) | |
(package-install pkg))))) | |
(install-package-if-not-installed installing-package-list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment