diff options
author | Jesús <heckyel@hyperbola.info> | 2018-06-29 22:31:11 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2018-06-29 22:31:11 -0500 |
commit | 15ea85ee14a5c40a8ed40d66fe591fe528a8719d (patch) | |
tree | ecb241b06ffc1a3ab3e1b275c83d761d03b35fc8 /lisp/init-elpa.el | |
download | emacs-base-15ea85ee14a5c40a8ed40d66fe591fe528a8719d.tar.lz emacs-base-15ea85ee14a5c40a8ed40d66fe591fe528a8719d.tar.xz emacs-base-15ea85ee14a5c40a8ed40d66fe591fe528a8719d.zip |
first commit
Diffstat (limited to 'lisp/init-elpa.el')
-rw-r--r-- | lisp/init-elpa.el | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lisp/init-elpa.el b/lisp/init-elpa.el new file mode 100644 index 0000000..28737de --- /dev/null +++ b/lisp/init-elpa.el @@ -0,0 +1,38 @@ +(require 'package) + +;; Repositories +;; ================ +(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) + (not (gnutls-available-p)))) + (proto (if no-ssl "http" "https"))) + ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired + (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) + ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) + (when (< emacs-major-version 24) + ;; For important compatibility libraries like cl-lib + (add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/"))))) +;; ================= + +;;; 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))))) +;; ================= + +(package-initialize) + +(provide 'init-elpa) |