Function: doom-modeline-mode
doom-modeline-mode is an interactive and natively compiled function
defined in doom-modeline.el.
Signature
(doom-modeline-mode &optional ARG)
Documentation
Toggle doom-modeline on or off.
This is a global minor mode. If called interactively, toggle the
Doom-Modeline mode mode. If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate (default-value \=doom-modeline-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
Key Bindings
This command is not in any keymaps.
Source Code
;; Defined in /nix/store/1lcicrdd2r4b8rkc91nnn74ymk1jl6yd-emacs-packages-deps/share/emacs/site-lisp/elpa/doom-modeline-20260928.1632/doom-modeline.el
;;;###autoload
(define-minor-mode doom-modeline-mode
"Toggle `doom-modeline' on or off."
:group 'doom-modeline
:global t
:lighter nil
:keymap doom-modeline-mode-map
(if doom-modeline-mode
(progn
(doom-modeline-refresh-bars) ; Create bars
(doom-modeline-set-main-modeline t) ; Set default mode-line
;; Apply to all existing buffers.
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (and mode-line-format
(not (doom-modeline-auto-set-modeline)))
(doom-modeline-set-main-modeline))))
;; For flymake
(setq flymake-mode-line-format nil) ; remove the lighter of minor mode
;; For Eldoc
(setq eldoc-message-function #'doom-modeline-eldoc-minibuffer-message)
;; For two-column editing
(setq 2C-mode-line-format (doom-modeline 'special))
;; For window
(if (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function #'doom-modeline-focus-change)
(with-no-warnings
(add-hook 'focus-in-hook #'doom-modeline-set-selected-window)
(add-hook 'focus-out-hook #'doom-modeline-unset-selected-window)))
(add-hook 'window-selection-change-functions #'doom-modeline-set-selected-window)
;; Automatically set mode-lines
(add-hook 'after-change-major-mode-hook #'doom-modeline-auto-set-modeline)
;; Setup font height cache
(add-hook 'after-setting-font-hook #'doom-modeline--reset-font-height-cache)
;; Special handles
(advice-add #'speedbar-set-mode-line-format :override #'doom-modeline-set-speebar-modeline)
(add-hook 'git-timemachine-mode-hook #'doom-modeline-set-git-timemachine-modeline)
(advice-add #'helm-display-mode-line :after #'doom-modeline-set-helm-modeline)
(setq helm-ag-show-status-function #'doom-modeline-set-helm-modeline))
(progn
;; Restore mode-line
(let ((original-format (doom-modeline--original-value 'mode-line-format)))
(setq-default mode-line-format original-format)
(dolist (buf (buffer-list))
(with-current-buffer buf
(when mode-line-format
(setq mode-line-format original-format)))))
;; For flymake
(setq flymake-mode-line-format (doom-modeline--original-value 'flymake-mode-line-format))
;; For Eldoc
(setq eldoc-message-function #'eldoc-minibuffer-message)
;; For two-column editing
(setq 2C-mode-line-format (doom-modeline--original-value '2C-mode-line-format))
;; Cleanup
;; For window
(if (boundp 'after-focus-change-function)
(remove-function after-focus-change-function #'doom-modeline-focus-change)
(with-no-warnings
(remove-hook 'focus-in-hook #'doom-modeline-set-selected-window)
(remove-hook 'focus-out-hook #'doom-modeline-unset-selected-window)))
(remove-hook 'window-selection-change-functions #'doom-modeline-set-selected-window)
;; For major modes
(remove-hook 'after-change-major-mode-hook #'doom-modeline-auto-set-modeline)
;; For font height cache
(remove-hook 'after-setting-font-hook #'doom-modeline--reset-font-height-cache)
;; For special handles
(advice-remove #'speedbar-set-mode-line-format #'doom-modeline-set-speebar-modeline)
(and (fboundp 'speedbar-set-mode-line-format) (speedbar-set-mode-line-format)) ; reset speedbar
(remove-hook 'git-timemachine-mode-hook #'doom-modeline-set-git-timemachine-modeline)
(advice-remove #'helm-display-mode-line #'doom-modeline-set-helm-modeline)
(setq helm-ag-show-status-function (default-value 'helm-ag-show-status-function)))))