From f7131b19b2f901988f54af76a09daadc75c80869 Mon Sep 17 00:00:00 2001 From: Gene Pasquet Date: Fri, 7 Mar 2025 05:05:13 +0000 Subject: Move to a straight-centric approach --- README.md | 20 ++++++++++++---- TODO.org | 7 +++--- substrate.el | 74 ++++++++++++++++++++++++++---------------------------------- 3 files changed, 52 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 0aa8de1..152ad33 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,16 @@ A clean basis to organically grow your config onto. -**NOTICE:** Requires Emacs 29.1 or better. +``` + .⌒. ▗▄▄▖▗ ▖ ▗▖ ▗▄ ▄▄ ▄▄ ▗ ▖▗▄▄ ▄▄ ▄▄▄▖▗▄▄ ▗▖ ▄▄▄▖▗▄▄▖ + .# #. ▐ ▐▌▐▌ ▐▌ ▗▘ ▘▐▘ ▘ ▐▘ ▘▐ ▌▐ ▌▐▘ ▘ ▐ ▐ ▝▌ ▐▌ ▐ ▐ + / \ ▐▄▄▖▐▐▌▌ ▌▐ ▐ ▝▙▄ ▝▙▄ ▐ ▌▐▄▄▘▝▙▄ ▐ ▐▄▄▘ ▌▐ ▐ ▐▄▄▖ + (,,,___,,,) ▐ ▐▝▘▌ ▙▟ ▐ ▝▌ ▝▌▐ ▌▐ ▌ ▝▌ ▐ ▐ ▝▖ ▙▟ ▐ ▐ + ) ( ▐▄▄▖▐ ▌▐ ▌ ▚▄▘▝▄▟▘ ▝▄▟▘▝▄▄▘▐▄▄▘▝▄▟▘ ▐ ▐ ▘▐ ▌ ▐ ▐▄▄▖ + (___) +``` + +**NOTICE:** Requires Emacs 29.1 or newer. ## Description @@ -12,6 +21,7 @@ This is a minimal Emacs base config. Here's the short of the philosophy: - Emacs-lisp centric, encourage configuration through code - Provide an upgrade path for Substrate - Stay minimal, only include as little packages and config as possible + - Encourage tweaking and coding of Emacs and its ecosystem - Keep to the project vision, even though users are free to turn features off ## Installation @@ -66,7 +76,6 @@ And restart emacs. Substrate can be configured through Emacs's built-in customisation framework. To access it, use `M-x customize` and search for `substrate`. Alternatively, set the options with `setopt` in your init file. The available options are: -- `substrate-initialise-packages`: Initialise the substrate package system (straight.el) - default `t` - `substrate-enable-windmove`: Enable windmove to hop around windows with ctrl+arrow - default `t` - `substrate-display-startup-help`: Show a help window on startup - default `t` - `substrate-enable-which-key`: Use which-key to list available key combos - default `t` @@ -79,7 +88,6 @@ If you'd rather use `setopt` to configure those variables, it can be used like s ```lisp ;; Configure all the opposite defaults for substrate -(setopt substrate-initialise-packages nil) (setopt substrate-enable-windmove nil) (setopt substrate-display-startup-help nil) (setopt substrate-enable-which-key nil) @@ -102,6 +110,11 @@ Then set your favourite theme. Instead of using `load-theme`, use `substrate-set ```lisp (use-package nord-theme :config (substrate-set-theme 'nord)) + +;; Or + +(straight-use-package 'nord-theme) +(substrate-set-theme 'nord) ``` ## Screenshots @@ -126,7 +139,6 @@ Emacs 29.1 or later. Emacs 29.1 is, as of 2023-09-04, the latest stable release. The specific features from Emacs 29.1 that Substrate relies on are: - - The `use-package` macro for configuration - Enhancements to the built-in completion help (`completions-auto-select`, `completion-auto-help`, etc.) - Built-in tree-sitter support - Built-in LSP client (Eglot) diff --git a/TODO.org b/TODO.org index ef258a6..f571cbe 100644 --- a/TODO.org +++ b/TODO.org @@ -1,3 +1,4 @@ -* Provide a one-script install for busy people -* Add config for popular vim-like input system -* Pick useful bits of config from bedrock extras +* DONE Provide a one-script install for busy people +* DONE Add config for popular vim-like input system +* TODO Pick useful bits of config from bedrock extras +* TODO Migrate to straight-based upgrade after initial install diff --git a/substrate.el b/substrate.el index 2a5c7eb..155245f 100644 --- a/substrate.el +++ b/substrate.el @@ -16,9 +16,6 @@ ;;; Custom variables (defgroup substrate nil "Custom options for substrate") -(defcustom substrate-initialise-packages t - "Initialise the substrate package system (straight.el)" - :type 'boolean :group 'substrate) (defcustom substrate-enable-windmove t "Enable windmove to hop around windows with ctrl+arrow" :type 'boolean :group 'substrate) @@ -104,29 +101,28 @@ ;; Package initialization ;; - (when substrate-initialise-packages - ;; Set up package and enable melpa - (require 'package) - (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) - (package-initialize) - - ;; Boostrap straight.el - (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)) - (setq straight-use-package-by-default t)) + ;; Set up package and enable melpa + (require 'package) + (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) + (package-initialize) + + ;; Boostrap straight.el + (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)) + (setq straight-use-package-by-default t) (setopt initial-major-mode 'fundamental-mode) ; default mode for the *scratch* buffer (setopt display-time-default-load-average nil) ; this information is useless for most @@ -137,7 +133,7 @@ ;; https://todo.sr.ht/~ashton314/emacs-bedrock/11 (setopt auto-revert-interval 5) (setopt auto-revert-check-vc-info t) - (global-auto-revert-mode) + (global-auto-revert-mode t) ;; Save history of minibuffer (savehist-mode) @@ -177,21 +173,15 @@ If the new path's directories does not exist, create them." ;; which-key: shows a popup of available keybindings when typing a long key ;; sequence (e.g. C-x ...) - (use-package which-key - :ensure t - :if substrate-enable-which-key - :config - (which-key-mode)) - (use-package evil - :ensure t - :if substrate-enable-evil + (when substrate-enable-which-key + (straight-use-package 'which-key) + (which-key-mode)) - :init + (when substrate-enable-evil (setq evil-respect-visual-line-mode t) (setq evil-undo-system 'undo-redo) - - :config + (straight-use-package 'evil) (evil-mode) ;; If you use Magit, start editing in insert state @@ -293,10 +283,10 @@ If the new path's directories does not exist, create them." ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (use-package evangelion-theme - :if substrate-configure-theme - :ensure t - :config (substrate-set-theme 'evangelion)) + (when substrate-configure-theme + (straight-use-package 'challenger-deep-theme) + (substrate-set-theme 'challenger-deep)) + ;;; Relegate automatic custom variables to their own file. (setq custom-file (expand-file-name "custom-vars.el")) -- cgit v1.2.3