From 8967217bac450b3667650851d7ff0844c1939e95 Mon Sep 17 00:00:00 2001 From: cashmere Date: Wed, 11 Mar 2026 03:55:26 +0100 Subject: refactor: migrate from straight.el to elpaca package manager - Replace straight.el bootstrap in init.el with elpaca bootstrap - Convert all use-package :straight keywords to elpaca-style :ensure - Remove redundant :straight nil/:straight t declarations - Remove yy/cache startup speed section (no longer needed with elpaca) - Add missing :ensure t to packages that relied on straight-use-package-by-default - Use :ensure (:wait t) for critical packages (general, evil, evil-collection, perspective, projectile, org-contrib) - Move nerd-icons declaration earlier alongside nerd-icons-ibuffer - Move ox-gfm declaration to denote-publish section - Comment out flyover section and maple-modeline header-line logic - Update consult hidden buffer filter for elpaca --- init.el | 69 +++++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 21 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 0380708..c4288d9 100644 --- a/init.el +++ b/init.el @@ -1,29 +1,56 @@ ;; -*- lexical-binding: t; -*- -(setq straight-check-for-modifications nil) -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name - "straight/repos/straight.el/bootstrap.el" - (or (bound-and-true-p straight-base-dir) - user-emacs-directory))) - (bootstrap-version 7)) - (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)) +;; Pre-set elpaca-core-date for dev Emacs builds (31.x) where the +;; release table has no entry and emacs-build-time may be nil at load time. +(defvar elpaca-core-date + (list (string-to-number (format-time-string "%Y%m%d" (or emacs-build-time (current-time)))))) -(straight-use-package '(project :type built-in)) -(straight-use-package '(xref :type built-in)) -(straight-use-package 'use-package) +;; Elpaca bootstrap +(defvar elpaca-installer-version 0.12) +(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) +(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) +(defvar elpaca-sources-directory (expand-file-name "sources/" elpaca-directory)) +(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" + :ref nil :depth 1 :inherit ignore + :files (:defaults "elpaca-test.el" (:exclude "extensions")) + :build (:not elpaca-activate))) +(let* ((repo (expand-file-name "elpaca/" elpaca-sources-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 (apply #'call-process `("git" nil ,buffer t "clone" + ,@(when-let* ((depth (plist-get order :depth))) + (list (format "--depth=%d" depth) "--no-single-branch")) + ,(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))) + (progn (message "%s" (buffer-string)) (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) + (let ((load-source-file-function nil)) (load "./elpaca-autoloads")))) +(add-hook 'after-init-hook #'elpaca-process-queues) +(elpaca `(,@elpaca-order)) -(setq straight-use-package-by-default t) +;; Install use-package support +(elpaca (elpaca-use-package :wait t) + (elpaca-use-package-mode)) -(straight-use-package 'org) +;; Install org before tangling config.org +(elpaca (org :wait t)) (org-babel-load-file (expand-file-name "config.org" user-emacs-directory)) (custom-set-variables -- cgit v1.3.1