aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2025-02-12 17:32:19 +0000
committerGene Pasquet <dev@etenil.net>2025-02-12 17:32:19 +0000
commit8d40ddffdb8111babc630d89678baa198ddbdfc4 (patch)
treea11b358fa43effe352efe0f95e3d3fdc0402c6d5
parent2d6e5c6697e362ce967a6f0685a7d798c3dbe054 (diff)
Theme and various fixes
-rw-r--r--README.md15
-rw-r--r--early-substrate.el15
-rw-r--r--substrate.el63
3 files changed, 56 insertions, 37 deletions
diff --git a/README.md b/README.md
index b5df9cc..0507a0d 100644
--- a/README.md
+++ b/README.md
@@ -60,6 +60,21 @@ popd
And restart emacs.
+## Setting a different theme
+
+To set a different theme, first disable the default theme from Substrate like so:
+
+```lisp
+(setopt substrate-configure-theme t)
+```
+
+Then set your favourite theme. Instead of using `load-theme`, use `substrate-set-theme`, as it will also work when running emacs as a daemon.
+
+```lisp
+(use-package nord-theme
+ :config (substrate-set-theme 'nord))
+```
+
## Screenshots
What you should see on opening Emacs up with Substrate installed: a simple splash screen, [modus-vivendi](https://protesilaos.com/emacs/modus-themes) active, and the `help-quick` display at the bottom.
diff --git a/early-substrate.el b/early-substrate.el
index a4396c0..ff4937a 100644
--- a/early-substrate.el
+++ b/early-substrate.el
@@ -16,18 +16,9 @@
(setq frame-resize-pixelwise t)
(tool-bar-mode -1) ; All these tools are in the menu-bar anyway
(menu-bar-mode -1)
-(scroll-bar-mode -1)
-(setq default-frame-alist '((fullscreen . maximized)
-
- ;; You can turn off scroll bars by uncommenting these lines:
- ;; (vertical-scroll-bars . nil)
- ;; (horizontal-scroll-bars . nil)
-
- ;; Setting the face in here prevents flashes of
- ;; color as the theme gets activated
- (background-color . "#000000")
- (foreground-color . "#ffffff")
- (ns-appearance . dark)
+(setq default-frame-alist '((vertical-scroll-bars . nil)
+ (horizontal-scroll-bars . nil)
+ (ns-appearance . dark)
(ns-transparent-titlebar . t)))
(provide 'early-substrate)
;; End of early-substrate.el
diff --git a/substrate.el b/substrate.el
index f856ce1..f0c916d 100644
--- a/substrate.el
+++ b/substrate.el
@@ -1,3 +1,4 @@
+;;; -*- lexical-binding: t -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; .⌒. ▗▄▄▖▗ ▖ ▗▖ ▗▄ ▄▄ ▄▄ ▗ ▖▗▄▄ ▄▄ ▄▄▄▖▗▄▄ ▗▖ ▄▄▄▖▗▄▄▖ ;;;
;;; .# #. ▐ ▐▌▐▌ ▐▌ ▗▘ ▘▐▘ ▘ ▐▘ ▘▐ ▌▐ ▌▐▘ ▘ ▐ ▐ ▝▌ ▐▌ ▐ ▐ ;;;
@@ -38,12 +39,24 @@
:type 'boolean :group 'substrate)
+(defun substrate-set-theme (theme)
+ (if (daemonp)
+ (add-hook 'after-make-frame-functions
+ (defun substrate--load-theme-daemon (frame)
+ (with-selected-frame frame
+ (load-theme theme t))
+ ;; Run this hook only once.
+ (remove-hook 'after-make-frame-functions
+ #'substrate--load-theme-daemon)
+ (fmakunbound 'substrate--load-theme-daemon)))
+ (load-theme theme t)))
+
(defun substrate-init ()
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;;
- ;;; Basic settings
- ;;;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; Basic settings
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Package initialization
;;
@@ -69,9 +82,9 @@
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
- (setq straight-use-package-by-default t))
+ (setq straight-use-package-by-default t))
- (setopt initial-major-mode 'fundamental-mode) ; default mode for the *scratch* buffer
+ (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
;; Automatically reread from disk if the underlying file changes
@@ -134,18 +147,18 @@ If the new path's directories does not exist, create them."
;; For help, see: https://www.masteringemacs.org/article/understanding-minibuffer-completion
- (setopt enable-recursive-minibuffers t) ; Use the minibuffer whilst in the minibuffer
- (setopt completion-cycle-threshold 1) ; TAB cycles candidates
- (setopt completions-detailed t) ; Show annotations
- (setopt tab-always-indent 'complete) ; When I hit TAB, try to complete, otherwise, indent
+ (setopt enable-recursive-minibuffers t) ; Use the minibuffer whilst in the minibuffer
+ (setopt completion-cycle-threshold 1) ; TAB cycles candidates
+ (setopt completions-detailed t) ; Show annotations
+ (setopt tab-always-indent 'complete) ; When I hit TAB, try to complete, otherwise, indent
(setopt completion-styles '(basic initials substring)) ; Different styles to match input to candidates
- (setopt completion-auto-help 'always) ; Open completion always; `lazy' another option
- (setopt completions-max-height 20) ; This is arbitrary
+ (setopt completion-auto-help 'always) ; Open completion always; `lazy' another option
+ (setopt completions-max-height 20) ; This is arbitrary
(setopt completions-detailed t)
(setopt completions-format 'one-column)
(setopt completions-group t)
- (setopt completion-auto-select 'second-tab) ; Much more eager
+ (setopt completion-auto-select 'second-tab) ; Much more eager
;(setopt completion-auto-select t) ; See `C-h v completion-auto-select' for more possible values
(keymap-set minibuffer-mode-map "TAB" 'minibuffer-complete) ; TAB acts more like how it does in the shell
@@ -164,14 +177,14 @@ If the new path's directories does not exist, create them."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Mode line information
- (setopt line-number-mode t) ; Show current line in modeline
- (setopt column-number-mode t) ; Show column as well
+ (setopt line-number-mode t) ; Show current line in modeline
+ (setopt column-number-mode t) ; Show column as well
- (setopt x-underline-at-descent-line nil) ; Prettier underlines
- (setopt switch-to-buffer-obey-display-actions t) ; Make switching buffers more consistent
+ (setopt x-underline-at-descent-line nil) ; Prettier underlines
+ (setopt switch-to-buffer-obey-display-actions t) ; Make switching buffers more consistent
- (setopt show-trailing-whitespace nil) ; By default, don't underline trailing spaces
- (setopt indicate-buffer-boundaries 'left) ; Show buffer top and bottom in the margin
+ (setopt show-trailing-whitespace nil) ; By default, don't underline trailing spaces
+ (setopt indicate-buffer-boundaries 'left) ; Show buffer top and bottom in the margin
;; Enable horizontal scrolling
(setopt mouse-wheel-tilt-scroll t)
@@ -183,8 +196,8 @@ If the new path's directories does not exist, create them."
;; (setopt tab-width 4)
;; Misc. UI tweaks
- (blink-cursor-mode -1) ; Steady cursor
- (pixel-scroll-precision-mode) ; Smooth scrolling
+ (blink-cursor-mode -1) ; Steady cursor
+ (pixel-scroll-precision-mode) ; Smooth scrolling
;; Use common keystrokes by default
(when substrate-enable-cua-mode
@@ -193,7 +206,7 @@ If the new path's directories does not exist, create them."
;; Display line numbers in programming mode
(when substrate-display-line-numbers
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
- (setopt display-line-numbers-width 3)) ; Set a minimum width
+ (setopt display-line-numbers-width 3)) ; Set a minimum width
;; Nice line wrapping when working with text
(add-hook 'text-mode-hook 'visual-line-mode)
@@ -224,12 +237,12 @@ If the new path's directories does not exist, create them."
(use-package evangelion-theme
:if substrate-configure-theme
:ensure t
- :config (load-theme 'evangelion t))
+ :config (substrate-set-theme 'evangelion))
;;; Relegate automatic custom variables to their own file.
(setq custom-file (expand-file-name "custom-vars.el"))
-) ;; End substrate-init
+ ) ;; End substrate-init
(provide 'substrate)
;;; End of substrate.el