diff --git a/core/core-keybinds.el b/core/core-keybinds.el index 2e5cb97f3..9e0e1b927 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -60,11 +60,6 @@ If any hook returns non-nil, all hooks after it are ignored.") (set-face-attribute 'which-key-local-map-description-face nil :weight 'bold) (which-key-setup-side-window-bottom) (setq-hook! 'which-key-init-buffer-hook line-spacing 3) - (defun doom*no-fringes-in-which-key-buffer (&rest _) - (doom|no-fringes-in-minibuffer) - (set-window-fringes (get-buffer-window which-key--buffer) 0 0 nil)) - (advice-add 'which-key--show-buffer-side-window :after #'doom*no-fringes-in-which-key-buffer) - (which-key-mode +1)) diff --git a/core/core-ui.el b/core/core-ui.el index 7b901116a..ed573188f 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -134,19 +134,6 @@ Expects a `font-spec'.") ;; ;; Built-in packages -;; Handle ansi codes in compilation buffer -(add-hook 'compilation-filter-hook #'doom|apply-ansi-color-to-compilation-buffer) - - -;; show typed keystrokes in minibuffer -(defun doom|enable-ui-keystrokes () (setq echo-keystrokes 0.02)) -(defun doom|disable-ui-keystrokes () (setq echo-keystrokes 0)) -(doom|enable-ui-keystrokes) -;; ...but hide them while isearch is active -(add-hook 'isearch-mode-hook #'doom|disable-ui-keystrokes) -(add-hook 'isearch-mode-end-hook #'doom|enable-ui-keystrokes) - - (def-package! hl-line ; built-in ;; Highlights the current line :hook ((prog-mode text-mode conf-mode) . hl-line-mode) @@ -224,23 +211,6 @@ Expects a `font-spec'.") (newline-mark ?\n [?¬ ?\n]) (space-mark ?\ [?·] [?.]))) -(defun doom|highlight-non-default-indentation () - "Highlight whitespace that doesn't match your `indent-tabs-mode' setting." - (unless (or (bound-and-true-p global-whitespace-mode) - (bound-and-true-p whitespace-mode) - (eq indent-tabs-mode (default-value 'indent-tabs-mode)) - (eq major-mode 'fundamental-mode) - (derived-mode-p 'special-mode)) - (require 'whitespace) - (set (make-local-variable 'whitespace-style) - (if (or (bound-and-true-p whitespace-mode) - (bound-and-true-p whitespace-newline-mode)) - (cl-union (if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark)) - whitespace-style) - `(face ,@(if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark)) - trailing-lines tail))) - (whitespace-mode +1))) - ;; ;; Line numbers @@ -396,10 +366,24 @@ frame's window-system, the theme will be reloaded.") ;; simple name in frame title (setq frame-title-format '("%b – Doom Emacs")) + ;; relegate tooltips to echo area only (if (boundp 'tooltip-mode) (tooltip-mode -1)) -;; a good indicator that Emacs isn't frozen -(add-hook 'doom-init-ui-hook #'blink-cursor-mode) + +;; enabled by default; no thanks, too distracting +(blink-cursor-mode -1) + +;; Handle ansi codes in compilation buffer +(add-hook 'compilation-filter-hook #'doom|apply-ansi-color-to-compilation-buffer) + +;; show typed keystrokes in minibuffer +(defun doom|enable-ui-keystrokes () (setq echo-keystrokes 0.02)) +(defun doom|disable-ui-keystrokes () (setq echo-keystrokes 0)) +(doom|enable-ui-keystrokes) +;; ...but hide them while isearch is active +(add-hook 'isearch-mode-hook #'doom|disable-ui-keystrokes) +(add-hook 'isearch-mode-end-hook #'doom|enable-ui-keystrokes) + ;; Make `next-buffer', `other-buffer', etc. ignore unreal buffers. (add-to-list 'default-frame-alist '(buffer-predicate . doom-buffer-frame-predicate)) ;; Prevent the glimpse of un-styled Emacs by setting these early. @@ -409,12 +393,6 @@ frame's window-system, the theme will be reloaded.") ;; prompts the user for confirmation when deleting a non-empty frame (global-set-key [remap delete-frame] #'doom/delete-frame) -(defun doom|no-fringes-in-minibuffer (&rest _) - "Disable fringes in the minibuffer window." - (set-window-fringes (minibuffer-window) 0 0 nil)) -(add-hook! '(doom-init-ui-hook minibuffer-setup-hook window-configuration-change-hook) - #'doom|no-fringes-in-minibuffer) - (defun doom|protect-visible-buffer () "Don't kill the current buffer if it is visible in another window (bury it instead). Meant for `kill-buffer-query-functions'." @@ -425,6 +403,23 @@ instead). Meant for `kill-buffer-query-functions'." "Don't kill the scratch buffer. Meant for `kill-buffer-query-functions'." (not (eq (current-buffer) (doom-fallback-buffer)))) +(defun doom|highlight-non-default-indentation () + "Highlight whitespace that doesn't match your `indent-tabs-mode' setting." + (unless (or (bound-and-true-p global-whitespace-mode) + (bound-and-true-p whitespace-mode) + (eq indent-tabs-mode (default-value 'indent-tabs-mode)) + (eq major-mode 'fundamental-mode) + (derived-mode-p 'special-mode)) + (require 'whitespace) + (set (make-local-variable 'whitespace-style) + (if (or (bound-and-true-p whitespace-mode) + (bound-and-true-p whitespace-newline-mode)) + (cl-union (if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark)) + whitespace-style) + `(face ,@(if indent-tabs-mode '(tabs tab-mark) '(spaces space-mark)) + trailing-lines tail))) + (whitespace-mode +1))) + (defun doom|init-ui () "Initialize Doom's user interface by applying all its advice and hooks." (add-to-list 'kill-buffer-query-functions #'doom|protect-fallback-buffer nil #'eq) diff --git a/modules/ui/doom/config.el b/modules/ui/doom/config.el index 44c74a63c..b2e792d47 100644 --- a/modules/ui/doom/config.el +++ b/modules/ui/doom/config.el @@ -58,5 +58,19 @@ #'solaire-mode-reset) ;; org-capture takes an org buffer and narrows it. The result is erroneously ;; considered an unreal buffer, so solaire-mode must be restored. - (add-hook 'org-capture-mode-hook #'turn-on-solaire-mode)) + (add-hook 'org-capture-mode-hook #'turn-on-solaire-mode) + ;; Because fringes can't be given a buffer-local face, they can look odd, so + ;; we remove them in the minibuffer and which-key popups (they serve no + ;; purpose there anyway). + (defun +doom|disable-fringes-in-minibuffer (&rest _) + (set-window-fringes (minibuffer-window) 0 0 nil)) + (add-hook 'solaire-mode-hook #'+doom|disable-fringes-in-minibuffer) + + (defun doom*no-fringes-in-which-key-buffer (&rest _) + (+doom|disable-fringes-in-minibuffer) + (set-window-fringes (get-buffer-window which-key--buffer) 0 0 nil)) + (advice-add 'which-key--show-buffer-side-window :after #'doom*no-fringes-in-which-key-buffer) + + (add-hook! '(minibuffer-setup-hook window-configuration-change-hook) + #'+doom|disable-fringes-in-minibuffer))