[Feature] Add options: doom-modeline-buffer-state-icon and doom-modeline-buffer-modification-icon.

Close #158.
This commit is contained in:
Vincent Zhang 2019-04-20 16:39:40 +08:00
parent b464b69d26
commit 108fd78261
3 changed files with 42 additions and 29 deletions

View file

@ -148,16 +148,24 @@ Strongly recommend to use
;; Please refer to https://github.com/bbatsov/projectile/issues/657.
(setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
;; Whether display icons or not (if nil nothing will be showed).
;; Whether display icons in mode-line or not.
(setq doom-modeline-icon t)
;; Whether display the icon for major mode. It respects `doom-modeline-icon'.
(setq doom-modeline-major-mode-icon t)
;; Display color icons for `major-mode'. It respects `all-the-icons-color-icons'.
;; Whether display color icons for `major-mode'. It respects
;; `doom-modeline-icon' and `all-the-icons-color-icons'.
(setq doom-modeline-major-mode-color-icon t)
;; Whether display minor modes or not. Non-nil to display in mode-line.
;; Whether display icons for buffer states. It respects `doom-modeline-icon'.
(setq doom-modeline-buffer-state-icon t)
;; Whether display buffer modification icon. It respects `doom-modeline-icon'
;; and `doom-modeline-buffer-state-icon'.
(setq doom-modeline-buffer-modification-icon t)
;; Whether display minor modes in mode-line or not.
(setq doom-modeline-minor-modes nil)
;; If non-nil, a word count will be added to the selection-info modeline segment.

View file

@ -117,19 +117,22 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
buffer-name => comint.el<2> (uniquify buffer name)")
(defvar doom-modeline-icon (display-graphic-p)
"Whether show `all-the-icons' or not.
Non-nil to show the icons in mode-line.
The icons may not be showed correctly in terminal.")
"Whether display icons in mode-line or not.")
(defvar doom-modeline-major-mode-icon t
"Whether show the icon for major mode. It respects `doom-modeline-icon'.")
"Whether display the icon for major mode. It respects `doom-modeline-icon'.")
(defvar doom-modeline-major-mode-color-icon t
"Display color icons for `major-mode'. It respects `all-the-icons-color-icons'.")
"Whether display color icons for `major-mode'. It respects `doom-modeline-icon' and `all-the-icons-color-icons'.")
(defvar doom-modeline-buffer-state-icon t
"Whether display icons for buffer states. It respects `doom-modeline-icon'.")
(defvar doom-modeline-buffer-modification-icon t
"Whether display buffer modification icon. It respects `doom-modeline-icon' and `doom-modeline-buffer-state-icon'.")
(defvar doom-modeline-minor-modes nil
"Whether display minor modes or not. Non-nil to display in mode-line.")
"Whether display minor modes in mode-line or not.")
(defvar doom-modeline-enable-word-count nil
"If non-nil, a word count will be added to the selection-info modeline segment.")

View file

@ -231,13 +231,14 @@ buffer where knowing the current project directory is important."
"Displays an ICON with FACE, HEIGHT and VOFFSET.
TEXT is the alternative if it is not applicable.
Uses `all-the-icons-material' to fetch the icon."
(if doom-modeline-icon
(when icon
(if (and doom-modeline-icon
doom-modeline-buffer-state-icon
icon)
(doom-modeline-icon-material
icon
:face face
:height (or height 1.1)
:v-adjust (or voffset -0.225)))
:v-adjust (or voffset -0.225))
(when text
(propertize text 'face face))))
@ -250,7 +251,8 @@ Uses `all-the-icons-material' to fetch the icon."
"lock"
"%1*"
'doom-modeline-warning))
((and buffer-file-name (buffer-modified-p))
((and buffer-file-name (buffer-modified-p)
doom-modeline-buffer-modification-icon)
(doom-modeline-buffer-file-state-icon
"save"
"%1*"