[Feature] options: doom-modeline-buffer-encoding and doom-modeline-indent-info.

This commit is contained in:
Vincent Zhang 2019-05-14 02:11:40 +08:00
parent edd97bb2a0
commit 356e8d670a
2 changed files with 26 additions and 18 deletions

View file

@ -149,6 +149,12 @@ Given ~/Projects/FOSS/emacs/lisp/comint.el
(defvar doom-modeline-major-mode-color-icon t (defvar doom-modeline-major-mode-color-icon t
"Whether display color icons for `major-mode'. It respects `doom-modeline-icon' and `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-encoding t
"Whether display buffer encoding.")
(defvar doom-modeline-indent-info nil
"Whether display indentation information.")
(defvar doom-modeline-buffer-state-icon t (defvar doom-modeline-buffer-state-icon t
"Whether display icons for buffer states. It respects `doom-modeline-icon'.") "Whether display icons for buffer states. It respects `doom-modeline-icon'.")

View file

@ -419,21 +419,22 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(doom-modeline-def-segment buffer-encoding (doom-modeline-def-segment buffer-encoding
"Displays the encoding and eol style of the buffer the same way Atom does." "Displays the encoding and eol style of the buffer the same way Atom does."
(propertize (when doom-modeline-buffer-encoding
(concat (pcase (coding-system-eol-type buffer-file-coding-system) (propertize
(0 " LF") (concat (pcase (coding-system-eol-type buffer-file-coding-system)
(1 " RLF") (0 " LF")
(2 " CR")) (1 " RLF")
(let ((sys (coding-system-plist buffer-file-coding-system))) (2 " CR"))
(cond ((memq (plist-get sys :category) (let ((sys (coding-system-plist buffer-file-coding-system)))
'(coding-category-undecided coding-category-utf-8)) (cond ((memq (plist-get sys :category)
" UTF-8 ") '(coding-category-undecided coding-category-utf-8))
(t (upcase (symbol-name (plist-get sys :name)))))) " UTF-8 ")
" ") (t (upcase (symbol-name (plist-get sys :name))))))
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive) " ")
'help-echo 'mode-line-mule-info-help-echo 'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive)
'mouse-face '(:box 0) 'help-echo 'mode-line-mule-info-help-echo
'local-map mode-line-coding-system-map)) 'mouse-face '(:box 0)
'local-map mode-line-coding-system-map)))
;; ;;
@ -442,9 +443,10 @@ directory, the file name, and its state (modified, read-only or non-existent)."
(doom-modeline-def-segment indent-info (doom-modeline-def-segment indent-info
"Displays the indentation information." "Displays the indentation information."
(propertize (format " %s %d " (when doom-modeline-indent-info
(if indent-tabs-mode "TAB" "SPC") tab-width) (propertize (format " %s %d "
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive))) (if indent-tabs-mode "TAB" "SPC") tab-width)
'face (if (doom-modeline--active) 'mode-line 'mode-line-inactive))))
;; ;;
;; remote host ;; remote host