home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 6a7b3c14a60d078d58b14d8a0b58bd095796d507
parent 1ce9b6c71b66fe3b26b7532cfc60383123642cb3
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Thu, 21 May 2020 13:53:23 +0200

emacs: move modus-operandi-theme to early-init

I never use modus-vivendi so I can just run all from early-init to
avoid flash of unstyled emacs.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mtools/emacs/config/config-appearance.el | 98+------------------------------------------------------------------------------
Mtools/emacs/early-init.el | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Mtools/emacs/init.el | 1-
3 files changed, 50 insertions(+), 98 deletions(-)

diff --git a/tools/emacs/config/config-appearance.el b/tools/emacs/config/config-appearance.el @@ -62,103 +62,7 @@ Ignores `ARGS'." (mapc #'disable-theme custom-enabled-themes)) - (advice-add 'load-theme :before #'sbr/before-load-theme) - - (defvar contrib/after-load-theme-hook nil - "Hook run after a color theme is loaded using `load-theme'.") - - (defun contrib/run-after-load-theme-hook (&rest _) - "Run `contrib/after-load-theme-hook'." - (run-hooks 'contrib/after-load-theme-hook)) - - (advice-add #'load-theme :after #'contrib/run-after-load-theme-hook) - - (defcustom sbr/modus-themes-toggle-hook nil - "Hook that runs after `prot/modus-themes-toggle' is invoked." - :type 'hook) - - (defun sbr/modus-themes-toggle () - "Toggle between `sbr/modus-operandi' and `sbr/modus-vivendi'. -Also run `sbr/modus-themes-toggle-hook'." - (interactive) - (if (eq (car custom-enabled-themes) 'modus-operandi) - (sbr/modus-vivendi) - (sbr/modus-operandi)) - (run-hooks 'sbr/modus-themes-toggle-hook)) - - :bind ("<f10>" . sbr/modus-themes-toggle) - :hook ((after-init-hook . sbr/modus-operandi))) - -(use-package modus-operandi-theme - :init - (defun sbr/modus-operandi () - "Enable some Modus Operandi variables and load the theme. -This is used internally by `sbr/modus-themes-toggle'." - (setq modus-operandi-theme-slanted-constructs t - modus-operandi-theme-bold-constructs t - modus-operandi-theme-visible-fringes nil - modus-operandi-theme-3d-modeline t - modus-operandi-theme-subtle-diffs t - modus-operandi-theme-distinct-org-blocks nil - modus-operandi-theme-proportional-fonts nil - modus-operandi-theme-rainbow-headings t - modus-operandi-theme-section-headings nil - modus-operandi-theme-scale-headings nil - modus-operandi-theme-scale-1 1.05 - modus-operandi-theme-scale-2 1.1 - modus-operandi-theme-scale-3 1.15 - modus-operandi-theme-scale-4 1.2) - (load-theme 'modus-operandi t)) - :config - (defun sbr/modus-operandi-custom () - "Customize modus-operandi theme" - (if (member 'modus-operandi custom-enabled-themes) - (modus-operandi-theme-with-color-variables ; this macro allows us to access the colour palette - (custom-theme-set-faces - 'modus-operandi - `(whitespace-tab ((,class (:background "#ffffff" :foreground "#cccccc")))) - `(whitespace-space ((,class (:background "#ffffff" :foreground "#cccccc")))) - `(whitespace-hspace ((,class (:background "#ffffff" :foreground "#cccccc")))) - `(whitespace-newline ((,class (:background "#ffffff" :foreground "#cccccc")))) - `(whitespace-indentation ((,class (:background "#ffffff" :foreground "#cccccc")))) - )))) - (add-hook 'contrib/after-load-theme-hook 'sbr/modus-operandi-custom) - (sbr/modus-operandi)) - -(use-package modus-vivendi-theme - :init - (defun sbr/modus-vivendi () - "Enable some Modus Vivendi variables and load the theme. -This is used internally by `sbr/modus-themes-toggle'." - (setq modus-vivendi-theme-slanted-constructs t - modus-vivendi-theme-bold-constructs t - modus-vivendi-theme-visible-fringes nil - modus-vivendi-theme-3d-modeline t - modus-vivendi-theme-subtle-diffs t - modus-vivendi-theme-distinct-org-blocks nil - modus-vivendi-theme-proportional-fonts nil - modus-vivendi-theme-rainbow-headings nil - modus-vivendi-theme-section-headings nil - modus-vivendi-theme-scale-headings nil - modus-vivendi-theme-scale-1 1.05 - modus-vivendi-theme-scale-2 1.1 - modus-vivendi-theme-scale-3 1.15 - modus-vivendi-theme-scale-4 1.2) - (load-theme 'modus-vivendi t)) - :config - (defun sbr/modus-vivendi-custom () - "Customize modus-vivendi theme" - (if (member 'modus-vivendi custom-enabled-themes) - (modus-vivendi-theme-with-color-variables ; this macro allows us to access the colour palette - (custom-theme-set-faces - 'modus-vivendi - `(whitespace-tab ((,class (:background "#000000" :foreground "#666666")))) - `(whitespace-space ((,class (:background "#000000" :foreground "#666666")))) - `(whitespace-hspace ((,class (:background "#000000" :foreground "#666666")))) - `(whitespace-newline ((,class (:background "#000000" :foreground "#666666")))) - `(whitespace-indentation ((,class (:background "#000000" :foreground "#666666")))) - )))) - (add-hook 'contrib/after-load-theme-hook 'sbr/modus-vivendi-custom)) + (advice-add 'load-theme :before #'sbr/before-load-theme)) ;; -UseTheme ;; UseWindowDivider diff --git a/tools/emacs/early-init.el b/tools/emacs/early-init.el @@ -24,6 +24,55 @@ (setq file-name-handler-alist nil) ;; -FileNameHandler +;; EarlyThemeSetup +(defvar contrib/after-load-theme-hook nil + "Hook run after a color theme is loaded using `load-theme'.") + +(defun contrib/run-after-load-theme-hook (&rest _) + "Run `contrib/after-load-theme-hook'." + (run-hooks 'contrib/after-load-theme-hook)) + +(advice-add #'load-theme :after #'contrib/run-after-load-theme-hook) + +(add-to-list 'load-path (concat user-emacs-directory "lisp/modus-themes")) +(require 'modus-operandi-theme) + +(defun sbr/modus-operandi () + "Enable some Modus Operandi variables and load the theme. +This is used internally by `sbr/modus-themes-toggle'." + (setq modus-operandi-theme-slanted-constructs t + modus-operandi-theme-bold-constructs t + modus-operandi-theme-visible-fringes nil + modus-operandi-theme-3d-modeline t + modus-operandi-theme-subtle-diffs t + modus-operandi-theme-distinct-org-blocks nil + modus-operandi-theme-proportional-fonts nil + modus-operandi-theme-rainbow-headings t + modus-operandi-theme-section-headings nil + modus-operandi-theme-scale-headings nil + modus-operandi-theme-scale-1 1.05 + modus-operandi-theme-scale-2 1.1 + modus-operandi-theme-scale-3 1.15 + modus-operandi-theme-scale-4 1.2) + (load-theme 'modus-operandi t)) + +(defun sbr/modus-operandi-custom () + "Customize modus-operandi theme" + (if (member 'modus-operandi custom-enabled-themes) + (modus-operandi-theme-with-color-variables ; this macro allows us to access the colour palette + (custom-theme-set-faces + 'modus-operandi + `(whitespace-tab ((,class (:background "#ffffff" :foreground "#cccccc")))) + `(whitespace-space ((,class (:background "#ffffff" :foreground "#cccccc")))) + `(whitespace-hspace ((,class (:background "#ffffff" :foreground "#cccccc")))) + `(whitespace-newline ((,class (:background "#ffffff" :foreground "#cccccc")))) + `(whitespace-indentation ((,class (:background "#ffffff" :foreground "#cccccc")))) + )))) + +(add-hook 'contrib/after-load-theme-hook 'sbr/modus-operandi-custom) +(sbr/modus-operandi) +;; -EarlyThemeSetup + ;;-EarlyFontSetup (defconst font-height 130 "Default font-height to use.") diff --git a/tools/emacs/init.el b/tools/emacs/init.el @@ -188,7 +188,6 @@ ;; CfgLoad (add-to-list 'load-path (concat user-emacs-directory "lisp/")) -(add-to-list 'load-path (concat user-emacs-directory "lisp/modus-themes")) (add-to-list 'load-path (concat user-emacs-directory "lisp/vorg")) (require 'init-func) (vde/el-load-dir (concat user-emacs-directory "/config/"))