Elpaca: an okay package manager

This commit is contained in:
MitchMarq42 2022-08-24 19:20:19 -08:00
parent 563518d9ed
commit 5bd8701bd8
3 changed files with 48 additions and 0 deletions

View File

@ -69,6 +69,10 @@
;; minified bootstrap (split lines if you want) (or not) ;; 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) (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) (require 'mitch-packages)
;; Absolute line numbers. Relative ones are an annoyance to set up, sadly. ;; Absolute line numbers. Relative ones are an annoyance to set up, sadly.

35
lisp/elpaca-bootstrap.el Normal file
View File

@ -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

View File

@ -6,6 +6,15 @@
;; ----------------------------------------------------------------------------- ;; -----------------------------------------------------------------------------
;;; Code: ;;; 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 ;; diminish
(use-package diminish (use-package diminish
;; :straight (:type built-in) ;; :straight (:type built-in)