Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2014
275
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (require 'package)
  2.  
  3. (defvar marmalade '("marmalade" . "http://marmalade-repo.org/packages/"))
  4. (defvar gnu '("gnu" . "http://elpa.gnu.org/packages/"))
  5. (defvar melpa '("melpa" . "http://melpa.milkbox.net/packages/"))
  6. (defvar org-elpa '("org-elpa" . "http://orgmode.org/elpa/"))
  7. (defvar sc-elpa '("sc-elpa" . "http://joseito.republika.pl/sunrise-commander/"))
  8. (defvar melpa-stable '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/"))
  9.  
  10. ;; Add additional archives to package repos
  11. (setq package-archives '())
  12. (add-to-list 'package-archives org-elpa t)
  13. (add-to-list 'package-archives sc-elpa t)
  14. (add-to-list 'package-archives melpa-stable t)
  15. (add-to-list 'package-archives melpa t)
  16. (add-to-list 'package-archives marmalade t)
  17. (add-to-list 'package-archives gnu t)
  18.  
  19. (defvar elx/installed-packages
  20.   (list
  21.    (list 'stripe-buffer melpa t)
  22.    ;; [...] other packages
  23.   )
  24. )
  25.  
  26. (package-initialize)
  27.  
  28. (unless (and (file-exists-p "~/.emacs.d/elpa/archives/marmalade")
  29.              (file-exists-p "~/.emacs.d/elpa/archives/gnu")
  30.              (file-exists-p "~/.emacs.d/elpa/archives/org-elpa")
  31.              (file-exists-p "~/.emacs.d/elpa/archives/sc-elpa")
  32.              (file-exists-p "~/.emacs.d/elpa/archives/melpa"))
  33.   (package-refresh-contents))
  34.  
  35. (defun elx/packages-install (packages)
  36.   (mapc (lambda (pkg)
  37.           (let ((name (nth 0 pkg))
  38.                 (repo (nth 1 pkg))
  39.                 (activate-p (nth 2 pkg)))
  40.             (when (not (directory-files (expand-file-name "elpa" dotfiles-dir) nil
  41.                                         (format "^%s-[0-9]+" (regexp-quote (format "%s" name)))))
  42.               (message "Downloading '%s' ..." name)
  43.               (let ((package-archives (append (list repo) package-archives)))
  44.                 (package-initialize)
  45.                 (package-install name)))))
  46.         packages)
  47.   (package-initialize)
  48.   (delete-other-windows))
  49.  
  50. (message "Loading packages ...")
  51. (condition-case nil
  52.     (elx/packages-install elx/installed-packages)
  53.   (error
  54.    (package-refresh-contents)
  55.    (elx/packages-install elx/installed-packages)))
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement