Format codes.

This commit is contained in:
Vincent Zhang 2019-06-27 17:41:29 +08:00
parent 4befbbbdce
commit 24d30ccc1e
2 changed files with 30 additions and 44 deletions

View file

@ -79,10 +79,11 @@ Example: 'doom-modeline-env--ruby")
(add-hook 'find-file-hook #'doom-modeline-update-env) (add-hook 'find-file-hook #'doom-modeline-update-env)
(with-no-warnings (with-no-warnings
(if (boundp 'after-focus-change-function) (if (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function (add-function
(lambda () :after after-focus-change-function
(if (frame-focus-state) (lambda ()
(doom-modeline-update-env)))) (if (frame-focus-state)
(doom-modeline-update-env))))
(add-hook 'focus-in-hook #'doom-modeline-update-env))) (add-hook 'focus-in-hook #'doom-modeline-update-env)))
(defun doom-modeline-env--get (prog args callback) (defun doom-modeline-env--get (prog args callback)

View file

@ -202,10 +202,8 @@ buffer where knowing the current project directory is important."
(concat (concat
(if active (if active
icon icon
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
,(get-text-property 0 'face icon) :inherit mode-line-inactive)))
:inherit
mode-line-inactive)))
(doom-modeline-spc))) (doom-modeline-spc)))
(propertize (abbreviate-file-name default-directory) (propertize (abbreviate-file-name default-directory)
'face (if active 'face (if active
@ -249,9 +247,9 @@ buffer where knowing the current project directory is important."
"Displays an ICON with FACE, HEIGHT and VOFFSET. "Displays an ICON with FACE, HEIGHT and VOFFSET.
TEXT is the alternative if it is not applicable. TEXT is the alternative if it is not applicable.
Uses `all-the-icons-material' to fetch the icon." Uses `all-the-icons-material' to fetch the icon."
(if (and doom-modeline-icon (if (and doom-modeline-icon
doom-modeline-buffer-state-icon doom-modeline-buffer-state-icon
icon) icon)
(doom-modeline-icon-material (doom-modeline-icon-material
icon icon
:face face :face face
@ -358,10 +356,11 @@ mouse-1: Previous buffer\nmouse-3: Next buffer"
(with-no-warnings (with-no-warnings
(if (boundp 'after-focus-change-function) (if (boundp 'after-focus-change-function)
(add-function :after after-focus-change-function (add-function
(lambda () :after after-focus-change-function
(when (frame-focus-state) (lambda ()
(doom-modeline-update-buffer-file-name)))) (when (frame-focus-state)
(doom-modeline-update-buffer-file-name))))
(add-hook 'focus-in-hook #'doom-modeline-update-buffer-file-name t))) (add-hook 'focus-in-hook #'doom-modeline-update-buffer-file-name t)))
(when (>= emacs-major-version 26) (when (>= emacs-major-version 26)
@ -385,15 +384,11 @@ mouse-1: Previous buffer\nmouse-3: Next buffer"
(if (doom-modeline--active) (if (doom-modeline--active)
(if doom-modeline-major-mode-color-icon (if doom-modeline-major-mode-color-icon
icon icon
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit ,(let ((props (get-text-property 0 'face icon)))
,(let ((props (get-text-property 0 'face icon))) props (remove :inherit props))
props (remove :inherit props)) :inherit mode-line)))
:inherit (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
mode-line))) :inherit mode-line-inactive)))
(propertize icon 'face `(:inherit
,(get-text-property 0 'face icon)
:inherit
mode-line-inactive)))
(doom-modeline-vspc)))))) (doom-modeline-vspc))))))
(defsubst doom-modeline--buffer-state-icon () (defsubst doom-modeline--buffer-state-icon ()
@ -404,10 +399,8 @@ mouse-1: Previous buffer\nmouse-3: Next buffer"
(concat (concat
(if (doom-modeline--active) (if (doom-modeline--active)
icon icon
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
,(get-text-property 0 'face icon) :inherit mode-line-inactive)))
:inherit
mode-line-inactive)))
(doom-modeline-vspc))))) (doom-modeline-vspc)))))
(defsubst doom-modeline--buffer-name () (defsubst doom-modeline--buffer-name ()
@ -636,10 +629,8 @@ Uses `all-the-icons-octicon' to fetch the icon."
(doom-modeline-spc) (doom-modeline-spc)
(if active (if active
icon icon
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
,(get-text-property 0 'face icon) :inherit mode-line-inactive)))
:inherit
mode-line-inactive)))
(if doom-modeline-icon (doom-modeline-vspc)) (if doom-modeline-icon (doom-modeline-vspc))
(if active (if active
text text
@ -964,10 +955,8 @@ mouse-1: List all problems%s"
(when icon (when icon
(if active (if active
icon icon
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
,(get-text-property 0 'face icon) :inherit mode-line-inactive))))
:inherit
mode-line-inactive))))
(when (and doom-modeline-icon icon text) (when (and doom-modeline-icon icon text)
(doom-modeline-vspc)) (doom-modeline-vspc))
(when text (when text
@ -1732,10 +1721,8 @@ mouse-3: Reconnect to server" nick (eglot--major-mode server)))
(doom-modeline-spc) (doom-modeline-spc)
(if active (if active
icon icon
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
,(get-text-property 0 'face icon) :inherit mode-line-inactive)))
:inherit
mode-line-inactive)))
(doom-modeline-spc)))))) (doom-modeline-spc))))))
(defun doom-modeline-override-eglot-modeline () (defun doom-modeline-override-eglot-modeline ()
@ -2115,8 +2102,7 @@ we don't want to remove that so we just return the original."
(doom-modeline-spc) (doom-modeline-spc)
(if percent-str (if percent-str
(concat (concat
(propertize icon 'face `(:inherit (propertize icon 'face `(:inherit ,(get-text-property 0 'face icon)
,(get-text-property 0 'face icon)
:inherit ,face) :inherit ,face)
'help-echo help-echo) 'help-echo help-echo)
(if doom-modeline-icon (doom-modeline-vspc)) (if doom-modeline-icon (doom-modeline-vspc))
@ -2170,8 +2156,7 @@ we don't want to remove that so we just return the original."
(if doom-modeline-major-mode-color-icon (if doom-modeline-major-mode-color-icon
props props
(remove :inherit props))) (remove :inherit props)))
:inherit :inherit mode-line-inactive))))))
mode-line-inactive))))))
(let ((info (format-mode-line 'mode-line-buffer-identification))) (let ((info (format-mode-line 'mode-line-buffer-identification)))
(if active (if active
info info