aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/init-elpa.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/init-elpa.el')
-rw-r--r--lisp/init-elpa.el44
1 files changed, 12 insertions, 32 deletions
diff --git a/lisp/init-elpa.el b/lisp/init-elpa.el
index 5ba04d2..fd99d97 100644
--- a/lisp/init-elpa.el
+++ b/lisp/init-elpa.el
@@ -1,12 +1,7 @@
;;; Find and load the correct package.el
-;; When switching between Emacs 23 and 24, we always use the bundled package.el in Emacs 24
-(let ((package-el-site-lisp-dir
- (expand-file-name "site-lisp/package" user-emacs-directory)))
- (when (and (file-directory-p package-el-site-lisp-dir)
- (> emacs-major-version 23))
- (message "Removing local package.el from load-path to avoid shadowing bundled version")
- (setq load-path (remove package-el-site-lisp-dir load-path))))
-
+;; =====================================================
+;; use-package → https://github.com/jwiegley/use-package
+;; =====================================================
(require 'package)
;; Repositories
@@ -23,31 +18,16 @@
("gnu" . 1)
("org" . 3)))
;; =================
+(package-initialize)
-;; Refresh packages in Emacs
-;; ==========================
-(when (not package-archive-contents)
- (package-refresh-contents))
-
-;;; Find packages if not installed
-;; ================================
-;;; On-demand installation of packages
-(defun require-package (package &optional min-version no-refresh)
- "Install given PACKAGE, optionally requiring MIN-VERSION.
-If NO-REFRESH is non-nil, the available package lists will not be
-re-downloaded in order to locate PACKAGE."
- (if (package-installed-p package min-version)
- t
- (if (or (assoc package package-archive-contents) no-refresh)
- (if (boundp 'package-selected-packages)
- ;; Record this as a package the user installed explicitly
- (package-install package nil)
- (package-install package))
- (progn
- (package-refresh-contents)
- (require-package package min-version t)))))
-;; ================================
+(unless (package-installed-p 'use-package)
+ (package-refresh-contents)
+ (package-install 'use-package))
-(package-initialize)
+(require 'use-package)
+(setq use-package-always-ensure t)
+;; =====================================================
+;; End use-package
+;; =====================================================
(provide 'init-elpa)