Change how themes, fonts & modelines are loaded
WARNING: THIS IS A BREAKING CHANGE FOR THEME/FONT/NLINUM CUSTOMIZATIONS. This change was motivated by the need to decouple theme and font loading from the ui/doom module. Now, it is doom-core's purview. Theme and fonts are loaded after initfiles are read (attached to the doom-init-ui-hook hook), giving other modules (especially private ones) a chance to change the theme or fonts. + Refactor core-ui.el + New init hook: doom-init-ui-hook + Decouple theme/font loading from ui/doom + Load modelines are doom-init-ui-hook + New theme/font variables (replaces old ui/doom variables) + doom-theme + doom-font + doom-variable-pitch-font + doom-unicode-font + Change nlinum variables + doom-line-number-lpad + doom-line-number-rpad + doom-line-number-pad-char Addresses #117
This commit is contained in:
parent
804fd31aab
commit
ecd8ad0f46
8 changed files with 147 additions and 132 deletions
|
@ -1,28 +0,0 @@
|
|||
;;; ui/doom/autoload/doom.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +doom/reset-theme ()
|
||||
"Reset the color theme currently in use."
|
||||
(interactive)
|
||||
(let ((theme (or (car-safe custom-enabled-themes) +doom-theme)))
|
||||
(when theme
|
||||
(mapc #'disable-theme custom-enabled-themes))
|
||||
(load "doom-themes-common.el" nil t)
|
||||
(+doom|init)
|
||||
(+doom|refresh-bright-buffers)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +doom|restore-bright-buffers (&rest _)
|
||||
"Restore `doom-buffer-mode' in buffers when `persp-mode' loads a session."
|
||||
(dolist (buf (persp-buffer-list))
|
||||
(with-current-buffer buf
|
||||
(+doom|buffer-mode-on))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +doom|refresh-bright-buffers ()
|
||||
"Refresh `doom-buffer-mode', in case of graphical glitches."
|
||||
(dolist (win (window-list))
|
||||
(when (buffer-local-value 'doom-buffer-mode (window-buffer win))
|
||||
(with-selected-window win
|
||||
(doom-buffer-mode -1)
|
||||
(doom-buffer-mode +1)))))
|
|
@ -1,58 +1,15 @@
|
|||
;;; ui/doom/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +doom-theme 'doom-one
|
||||
"The color theme to use.")
|
||||
|
||||
(defvar +doom-font
|
||||
(font-spec :family "Fira Mono" :size 12)
|
||||
"The font currently in use.")
|
||||
|
||||
(defvar +doom-variable-pitch-font
|
||||
(font-spec :family "Fira Sans" :size 12)
|
||||
"The font currently in use.")
|
||||
|
||||
(defvar +doom-unicode-font
|
||||
(font-spec :family "DejaVu Sans Mono" :size 12)
|
||||
"Fallback font for unicode glyphs. Is ignored if :feature unicode is active.")
|
||||
|
||||
|
||||
;; Getting themes to remain consistent across GUI Emacs, terminal Emacs and
|
||||
;; daemon Emacs is hairy.
|
||||
;;
|
||||
;; + Running `+doom|init' directly sorts out the initial GUI frame.
|
||||
;; + Attaching it to `after-make-frame-functions' sorts out daemon Emacs.
|
||||
;; + Terminal Emacs is a bit of a wildcard.
|
||||
(defun +doom|init (&optional frame)
|
||||
"Set the theme and load the font, in that order."
|
||||
(load-theme +doom-theme t)
|
||||
|
||||
(with-demoted-errors "FONT ERROR: %s"
|
||||
(set-frame-font +doom-font nil (if frame (list frame) t))
|
||||
;; Fallback to `doom-unicode-font' for Unicode characters
|
||||
(unless (featurep! :ui unicode)
|
||||
(when +doom-unicode-font
|
||||
(set-fontset-font t 'unicode +doom-unicode-font frame)))
|
||||
;; ...and for variable-pitch mode
|
||||
(when +doom-variable-pitch-font
|
||||
(set-face-attribute 'variable-pitch frame :font +doom-variable-pitch-font))))
|
||||
|
||||
(defun +doom|init-daemon (frame)
|
||||
(when (or (daemonp) (not (display-graphic-p)))
|
||||
(with-selected-frame frame
|
||||
(run-with-timer 0 nil #'+doom|init))))
|
||||
|
||||
(add-hook 'after-make-frame-functions #'+doom|init)
|
||||
(add-hook 'after-make-frame-functions #'+doom|init-daemon)
|
||||
|
||||
|
||||
;; doom-one: gives Emacs a look inspired by Dark One in Atom.
|
||||
;; <https://github.com/hlissner/emacs-doom-theme>
|
||||
(def-package! doom-themes
|
||||
:demand t
|
||||
:config
|
||||
(+doom|init)
|
||||
(unless doom-theme
|
||||
(setq doom-theme 'doom-one))
|
||||
|
||||
;; blink mode-line on errors
|
||||
(add-hook 'doom-post-init-hook #'doom-themes-visual-bell-config)
|
||||
|
||||
;; Add file icons to doom-neotree
|
||||
(add-hook 'doom-post-init-hook #'doom-themes-neotree-config)
|
||||
(setq doom-neotree-enable-variable-pitch t
|
||||
|
@ -63,7 +20,7 @@
|
|||
(defun +doom|neotree-fix-popup ()
|
||||
"Ensure the fringe settings are maintained on popup restore."
|
||||
(neo-global--when-window
|
||||
(doom--neotree-no-fringes)))
|
||||
(doom--neotree-no-fringes)))
|
||||
(add-hook 'doom-popup-mode-hook #'+doom|neotree-fix-popup)))
|
||||
|
||||
|
||||
|
@ -79,6 +36,7 @@
|
|||
(defun +doom|reset-solaire-mode (&rest _) (solaire-mode-reset))
|
||||
(advice-add #'load-theme :after #'+doom|reset-solaire-mode)
|
||||
(add-hook 'doom-reload-hook #'solaire-mode-reset)
|
||||
(add-hook 'doom-init-ui-hook #'solaire-mode-reset)
|
||||
|
||||
;; Extra modes to activate doom-buffer-mode in
|
||||
(add-hook! (gist-mode
|
||||
|
@ -113,7 +71,7 @@
|
|||
ov 'display (propertize " [...] " 'face '+doom-folded-face))))))
|
||||
|
||||
|
||||
;; NOTE Adjust these bitmaps if you change `doom-ui-fringe-size'
|
||||
;; NOTE Adjust these bitmaps if you change `doom-fringe-size'
|
||||
(after! flycheck
|
||||
;; because git-gutter is in the left fringe
|
||||
(setq flycheck-indication-mode 'right-fringe)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue