doom-emacs/modules/ui/modeline/autoload.el
Henrik Lissner ad6a3d0f33
refactor: deprecate featurep! for modulep!
featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
2022-08-14 20:43:35 +02:00

36 lines
1.3 KiB
EmacsLisp

;;; ui/modeline/autoload/modeline.el -*- lexical-binding: t; -*-
(defvar +modeline--old-bar-height nil)
;;;###autoload
(defun +modeline-resize-for-font-h ()
"Adjust the modeline's height when the font size is changed by
`doom/increase-font-size' or `doom/decrease-font-size'.
Meant for `doom-change-font-size-hook'."
(unless +modeline--old-bar-height
(setq +modeline--old-bar-height doom-modeline-height))
(let ((default-height +modeline--old-bar-height)
(scale (or (frame-parameter nil 'font-scale) 0)))
(setq doom-modeline-height
(if (> scale 0)
(+ default-height (* scale doom-font-increment))
default-height))))
;;;###autoload
(defun +modeline-update-env-in-all-windows-h (&rest _)
"Update version strings in all buffers."
(dolist (window (window-list))
(with-selected-window window
(when (fboundp 'doom-modeline-update-env)
(doom-modeline-update-env))
(force-mode-line-update))))
;;;###autoload
(defun +modeline-clear-env-in-all-windows-h (&rest _)
"Blank out version strings in all buffers."
(unless (modulep! +light)
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(setq doom-modeline-env--version
(bound-and-true-p doom-modeline-load-string)))))
(force-mode-line-update t))