From a41c688aea01a71f25ad03241fc49253425e71f0 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Tue, 6 Jun 2023 10:33:30 +0200 Subject: [PATCH] feat: Add elpaca --- config.org | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/config.org b/config.org index a0762c6..ae1edec 100644 --- a/config.org +++ b/config.org @@ -6,6 +6,8 @@ * TABLE OF CONTENTS :toc: - [[#installation][Installation]] +- [[#base-packages-to-install-first][Base packages to install first]] + - [[#elpaca][Elpaca]] - [[#workarounds][Workarounds]] - [[#emacs-262][Emacs 26.2]] - [[#utils][Utils]] @@ -118,6 +120,111 @@ This configuration requires the installation of : =pip install jedi flake8 importmagic autopep8 yapf= - =ditaa= (for ascii to image generation in org-mode) +* Base packages to install first + +** Elpaca + +Replacement for built-in package manager package.el : + +https://github.com/progfolio/elpaca + +#+BEGIN_SRC emacs-lisp + (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)) +#+END_SRC + +*** Use-package support + +#+BEGIN_SRC emacs-lisp + ;; Install use-package support +(elpaca elpaca-use-package + ;; Enable :elpaca use-package keyword. + (elpaca-use-package-mode) + ;; Assume :elpaca t unless otherwise specified. + (setq elpaca-use-package-by-default t)) +#+END_SRC + +*** Wait till initialized + +#+BEGIN_SRC emacs-lisp +;;When installing a package which modifies a form used at the top-level +;;(e.g. a package which adds a use-package key word), +;;use `elpaca-wait' to block until that package has been installed/configured. +;;For example: +;;(use-package general :demand t) +;;(elpaca-wait) +(elpaca-wait) +#+END_SRC + * Workarounds ** Emacs 26.2