Variable: doom-modeline-mode

doom-modeline-mode is a customizable variable defined in doom-modeline.el.

Value

nil

Documentation

Non-nil if Doom-Modeline mode is enabled.

See the doom-modeline-mode(var)/doom-modeline-mode(fun) command for a description of this minor mode. Setting this variable directly does not take effect; either customize it (see the info node (emacs)Easy Customization) or call the function doom-modeline-mode(var)/doom-modeline-mode(fun).

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)))))