diff --git a/modules/tools/editorconfig/config.el b/modules/tools/editorconfig/config.el index 6c74a7a1d..b1d18a55f 100644 --- a/modules/tools/editorconfig/config.el +++ b/modules/tools/editorconfig/config.el @@ -56,7 +56,7 @@ extension, try to guess one." specified by editorconfig." (when (or (gethash 'indent_style props) (gethash 'indent_size props)) - (setq doom-inhibit-indent-detection t))) + (setq doom-inhibit-indent-detection 'editorconfig))) (add-hook 'editorconfig-after-apply-functions #'+editorconfig|disable-indent-detection) ;; Editorconfig makes indentation too rigid in Lisp modes, so tell diff --git a/modules/ui/modeline/config.el b/modules/ui/modeline/config.el index 121221daa..0d93d0e5e 100644 --- a/modules/ui/modeline/config.el +++ b/modules/ui/modeline/config.el @@ -28,10 +28,37 @@ (add-hook 'doom-load-theme-hook #'doom-modeline-refresh-bars) (add-hook '+doom-dashboard-mode-hook #'doom-modeline-set-project-modeline) + ;; Show indentation style in modeline. I'm not using + ;; `doom-modeline-def-segment' to prevent eager macro expansion from loading + ;; the package too soon. + (defun +modeline-indent-segment () + "indent modeline segment" + (propertize (format "%s%d" + (if indent-tabs-mode "⭾" "␣") + tab-width) + 'mouse-face 'mode-line-highlight + 'help-echo + (mapconcat #'identity + (list (format "Indentation style: %s (%d wide)" + (if indent-tabs-mode "tabs" "spaces") + tab-width) + (if (eq doom-inhibit-indent-detection 'editorconfig) + (propertize "✓ Editorconfig applied" 'face 'success) + (propertize "✘ Indentation auto-detection disabled" 'face 'warning)) + (when (bound-and-true-p ws-butler-mode) + (propertize "✓ ws-butler active (whitespace cleanup on save)" + 'face 'success)) + (when (bound-and-true-p dtrt-indent-original-indent) + (propertize (format "✓ Indentation auto-detected (original: %s)" + dtrt-indent-original-indent) + 'face 'success))) + " "))) + (add-to-list 'doom-modeline-fn-alist '(indent . +modeline-indent-segment)) + ;; Remove unused segments & extra padding (doom-modeline-def-modeline 'main '(bar matches buffer-info remote-host buffer-position selection-info) - '(misc-info persp-name irc mu4e github debug input-method buffer-encoding lsp major-mode process vcs checker)) + '(misc-info persp-name irc mu4e github debug indent input-method buffer-encoding lsp major-mode process vcs checker)) (doom-modeline-def-modeline 'special '(bar matches buffer-info-simple buffer-position selection-info)