From 386a598c15a727c51518758414d7a86e2c2d24e2 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Wed, 13 Dec 2023 19:18:44 -0900 Subject: [PATCH] Switch elpaca-bootstrap-file to a bootstrap script --- init.el | 16 +++++++++++++- lisp/elpaca-bootstrap.el | 45 ---------------------------------------- 2 files changed, 15 insertions(+), 46 deletions(-) delete mode 100644 lisp/elpaca-bootstrap.el diff --git a/init.el b/init.el index 493f04e..5f2209f 100644 --- a/init.el +++ b/init.el @@ -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)) diff --git a/lisp/elpaca-bootstrap.el b/lisp/elpaca-bootstrap.el deleted file mode 100644 index f1e837d..0000000 --- a/lisp/elpaca-bootstrap.el +++ /dev/null @@ -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