From 5bd8701bd8aac7b03327deacaef6cff9ea86cc43 Mon Sep 17 00:00:00 2001 From: MitchMarq42 Date: Wed, 24 Aug 2022 19:20:19 -0800 Subject: [PATCH] Elpaca: an okay package manager --- init.el | 4 ++++ lisp/elpaca-bootstrap.el | 35 +++++++++++++++++++++++++++++++++++ lisp/mitch-packages.el | 9 +++++++++ 3 files changed, 48 insertions(+) create mode 100644 lisp/elpaca-bootstrap.el diff --git a/init.el b/init.el index 41823ff..b167ef4 100644 --- a/init.el +++ b/init.el @@ -69,6 +69,10 @@ ;; minified bootstrap (split lines if you want) (or not) (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) (elpaca 'use-package (require 'use-package)) + + (require 'mitch-packages) ;; Absolute line numbers. Relative ones are an annoyance to set up, sadly. diff --git a/lisp/elpaca-bootstrap.el b/lisp/elpaca-bootstrap.el new file mode 100644 index 0000000..cfebb16 --- /dev/null +++ b/lisp/elpaca-bootstrap.el @@ -0,0 +1,35 @@ +;;; 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 diff --git a/lisp/mitch-packages.el b/lisp/mitch-packages.el index a9e08bb..d11c5ec 100644 --- a/lisp/mitch-packages.el +++ b/lisp/mitch-packages.el @@ -6,6 +6,15 @@ ;; ----------------------------------------------------------------------------- ;;; Code: +;; (elpaca-use-package elpaca +;; :init (require 'elpaca-bootstrap)) +(defmacro use-feature (name &rest args) + "Like `use-package' but accounting for asynchronous installation. +NAME and ARGS are in `use-package'." + (declare (indent defun)) + `(elpaca nil (use-package ,name + :ensure nil + ,@args))) ;; diminish (use-package diminish ;; :straight (:type built-in)