Switch elpaca-bootstrap-file to a bootstrap script

This commit is contained in:
MitchMarq42 2023-12-13 19:18:44 -09:00
parent bdcc7f5c87
commit 386a598c15
2 changed files with 15 additions and 46 deletions

16
init.el
View File

@ -63,7 +63,21 @@
;; (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (setq straight-use-package-by-default t)
;; actually, use elpaca instead
(require 'elpaca-bootstrap)
;; (require 'elpaca-bootstrap)
(setq elpaca-bootstrap-file (expand-file-name "elpaca-bootstrap.el"
user-emacs-directory))
(unless (file-exists-p elpaca-bootstrap-file)
(with-current-buffer
(pop-to-buffer
(url-retrieve-synchronously "https://raw.githubusercontent.com/progfolio/elpaca/master/README.md"))
(re-search-forward (rx "### Installer\n"))
(let ((start (1+ (re-search-forward "```emacs-lisp")))
(end (- (re-search-forward "\n```") 3)))
(write-region start end elpaca-bootstrap-file)
)))
(load-file elpaca-bootstrap-file)
(elpaca elpaca-use-package
(elpaca-use-package-mode)
(setq elpaca-use-package-by-default t))

View File

@ -1,45 +0,0 @@
;;; elpaca-bootstrap.el --- Bootstrap the Elpaca package manager
;;; Commentary:
;; Taken from https://github.com/progfolio/elpaca
;;; Code:
(defvar elpaca-installer-version 0.4)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil
:files (:defaults (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (call-process "git" nil buffer t "clone"
(plist-get order :repo) repo)))
((zerop (call-process "git" nil buffer t "checkout"
(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)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(kill-buffer buffer)
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
(provide 'elpaca-bootstrap)
;;; elpaca-bootstrap.el ends here