From fb8a361e1ffe83ae69273ed72eb5fb0c92035398 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 15 May 2017 21:00:33 +0200 Subject: [PATCH] ui/doom: refactor --- modules/ui/doom/autoload/doom.el | 18 +++++++++++++++- modules/ui/doom/config.el | 37 ++++++++++++++------------------ 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/modules/ui/doom/autoload/doom.el b/modules/ui/doom/autoload/doom.el index a204f1a9f..1cef9e2e2 100644 --- a/modules/ui/doom/autoload/doom.el +++ b/modules/ui/doom/autoload/doom.el @@ -7,5 +7,21 @@ (let ((theme (or (car-safe custom-enabled-themes) +doom-theme))) (when theme (mapc #'disable-theme custom-enabled-themes)) - (load-theme theme t))) + (load-theme theme t) + (+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))))) diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index ccfd2e2e5..83f240f18 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -43,20 +43,18 @@ :config (load-theme +doom-theme t) + ;; Add file icons to doom-neotree + (doom-themes-neotree-config) + (setq doom-neotree-enable-variable-pitch t + doom-neotree-file-icons 'simple + doom-neotree-line-spacing 2) + ;; Since Fira Mono doesn't have an italicized variant, highlight it instead (set-face-attribute 'italic nil :weight 'ultra-light :foreground "#ffffff" :background (face-background 'doom-hl-line)) - (defface +doom-folded-face - `((((background dark)) - (:inherit font-lock-comment-face :background ,(doom-color 'black))) - (((background light)) - (:inherit font-lock-comment-face :background ,(doom-color 'light-grey)))) - "Face to hightlight `hideshow' overlays." - :group 'doom) - ;; Dark frames by default (when (display-graphic-p) (push (cons 'background-color (face-background 'default)) default-frame-alist) @@ -76,19 +74,8 @@ (doom-buffer-mode -1))) (add-hook 'doom-popup-mode-hook #'+doom|buffer-mode-off) - (when (featurep! :feature workspaces) - (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)))) - (add-hook '+workspaces-load-session-hook #'+doom|restore-bright-buffers)) - - ;; Add file icons to doom-neotree - (doom-themes-neotree-config) - (setq doom-neotree-enable-variable-pitch t - doom-neotree-file-icons 'simple - doom-neotree-line-spacing 2)) + ;; + (add-hook '+workspaces-load-session-hook #'+doom|restore-bright-buffers)) ;; Flashes the line around the cursor after any motion command that might @@ -124,6 +111,14 @@ (after! hideshow + (defface +doom-folded-face + `((((background dark)) + (:inherit font-lock-comment-face :background ,(doom-color 'black))) + (((background light)) + (:inherit font-lock-comment-face :background ,(doom-color 'light-grey)))) + "Face to hightlight `hideshow' overlays." + :group 'doom) + ;; Nicer code-folding overlays (setq hs-set-up-overlay (lambda (ov)