emacs/lisp/elpaca-bootstrap.el

41 lines
2.0 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:
2023-02-23 11:34:17 -09:00
(defvar elpaca-installer-version 0.2)
2022-08-24 19:20:19 -08:00
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
2022-11-01 14:15:05 -08:00
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
2023-02-23 11:34:17 -09:00
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil
2023-02-23 11:34:17 -09:00
:files (:defaults (:exclude "extensions"))
:build (:not elpaca--activate-package)))
2023-02-23 11:34:17 -09:00
(when-let ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
((add-to-list 'load-path (if (file-exists-p build) build repo)))
2023-02-23 11:34:17 -09:00
((not (file-exists-p repo))))
2022-08-24 19:20:19 -08:00
(condition-case-unless-debug err
2023-02-23 11:34:17 -09:00
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-installer*"))
((zerop (call-process "git" nil buffer t "clone"
(plist-get order :repo) repo)))
(default-directory repo)
((zerop (call-process "git" nil buffer t "checkout"
2023-02-23 11:34:17 -09:00
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)"))))
(progn (require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
2023-02-23 11:34:17 -09:00
((error) (warn "%s" err) (delete-directory repo 'recursive))))
2022-08-24 19:20:19 -08:00
(require 'elpaca-autoloads)
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
2023-02-23 11:35:04 -09:00
(provide 'elpaca-bootstrap)
2022-08-24 19:20:19 -08:00
;;; elpaca-bootstrap.el ends here