emacs/lisp/elpaca-bootstrap.el

36 lines
1.5 KiB
EmacsLisp
Raw Normal View History

2022-08-24 19:20:19 -08:00
;;; elpaca-bootstrap.el --- Bootstrap the Elpaca package manager
;;; Commentary:
;; Taken from https://github.com/progfolio/elpaca
;;; Code:
(declare-function elpaca-generate-autoloads "elpaca")
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(when-let ((elpaca-repo (expand-file-name "repos/elpaca/" elpaca-directory))
(elpaca-build (expand-file-name "builds/elpaca/" elpaca-directory))
(elpaca-target (if (file-exists-p elpaca-build) elpaca-build elpaca-repo))
(elpaca-url "https://www.github.com/progfolio/elpaca.git")
((add-to-list 'load-path elpaca-target))
((not (file-exists-p elpaca-repo)))
(buffer (get-buffer-create "*elpaca-bootstrap*")))
(condition-case-unless-debug err
(progn
(unless (zerop (call-process "git" nil buffer t "clone" elpaca-url elpaca-repo))
(error "%s" (list (with-current-buffer buffer (buffer-string)))))
(byte-recompile-directory elpaca-repo 0 'force)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" elpaca-repo)
(kill-buffer buffer))
((error)
(delete-directory elpaca-directory 'recursive)
(with-current-buffer buffer
(goto-char (point-max))
(insert (format "\n%S" err))
(display-buffer buffer)))))
(require 'elpaca-autoloads)
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca (elpaca :host github :repo "progfolio/elpaca"))
(provide 'elpaca-bootstrap)
;;; elpaca-bootstrap.el ends here