doomemacs/modules/ui/modeline/config.el
Henrik Lissner dec2a387ad
fix(modeline): remove advice causing org-element cache errors in org
This advice was suppressing ws-butler's modification hooks, which had a
nasty side-effect of modifying org buffers without letting its
org-element cache know that it's stale, which resulted in errors like
this, followed by a backtrace:

  Warning (org-element): org-element--cache: Unregistered buffer modifications detected (175 != 176). Resetting.
  If this warning appears regularly, please report the warning text to Org mode mailing list (M-x org-submit-bug-report).

The advice isn't needed anymore, anyhow.
2024-07-26 04:46:54 -04:00

54 lines
2 KiB
EmacsLisp

;;; ui/modeline/config.el -*- lexical-binding: t; -*-
(when (modulep! +light)
(load! "+light"))
(use-package! doom-modeline
:unless (modulep! +light)
:hook (doom-after-init . doom-modeline-mode)
:hook (doom-modeline-mode . size-indication-mode) ; filesize in modeline
:hook (doom-modeline-mode . column-number-mode) ; cursor column in modeline
:init
;; We display project info in the modeline ourselves
(setq projectile-dynamic-mode-line nil)
;; Set these early so they don't trigger variable watchers
(setq doom-modeline-bar-width 3
doom-modeline-github nil
doom-modeline-mu4e nil
doom-modeline-persp-name nil
doom-modeline-minor-modes nil
doom-modeline-major-mode-icon nil
doom-modeline-buffer-file-name-style 'relative-from-project
;; Only show file encoding if it's non-UTF-8 and different line endings
;; than the current OSes preference
doom-modeline-buffer-encoding 'nondefault
doom-modeline-default-eol-type
(pcase doom-system ('macos 2) ('windows 1) (_ 0)))
:config
;; Fix an issue where these two variables aren't defined in TTY Emacs on MacOS
(defvar mouse-wheel-down-event nil)
(defvar mouse-wheel-up-event nil)
(add-hook 'after-setting-font-hook #'+modeline-resize-for-font-h)
(add-hook 'doom-load-theme-hook #'doom-modeline-refresh-bars)
(add-to-list 'doom-modeline-mode-alist '(+doom-dashboard-mode . dashboard))
(add-hook! 'magit-mode-hook
(defun +modeline-hide-in-non-status-buffer-h ()
"Show minimal modeline in magit-status buffer, no modeline elsewhere."
(if (eq major-mode 'magit-status-mode)
(doom-modeline-set-modeline 'magit)
(hide-mode-line-mode))))
;;
;;; Extensions
(use-package! anzu
:after-call isearch-mode)
(use-package! evil-anzu
:when (modulep! :editor evil)
:after-call evil-ex-start-search evil-ex-start-word-search evil-ex-search-activate-highlight
:config (global-anzu-mode +1)))