ui/modeline: refactor encoding segment

This commit is contained in:
Henrik Lissner 2019-12-21 01:38:43 -05:00
parent 95bea5b95b
commit f075c30710
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -464,16 +464,19 @@ lines are selected, or the NxM dimensions of a block selection.")
;;; `+modeline-encoding' ;;; `+modeline-encoding'
(def-modeline-var! +modeline-encoding (def-modeline-var! +modeline-encoding
'(:eval '(:eval
(concat (pcase (coding-system-eol-type buffer-file-coding-system) (concat (coding-system-eol-type-mnemonic buffer-file-coding-system)
(0 " LF ") " "
(1 " RLF ")
(2 " CR "))
(let ((sys (coding-system-plist buffer-file-coding-system))) (let ((sys (coding-system-plist buffer-file-coding-system)))
(if (memq (plist-get sys :category) (if (memq (plist-get sys :category)
'(coding-category-undecided coding-category-utf-8)) '(coding-category-undecided coding-category-utf-8))
"UTF-8" "UTF-8"
(upcase (symbol-name (plist-get sys :name))))) (upcase (symbol-name (plist-get sys :name))))))))
" ")))
;; Clearer mnemonic labels for EOL styles
(setq eol-mnemonic-dos "CRLF"
eol-mnemonic-mac "CR"
eol-mnemonic-unix "LF"
eol-mnemonic-undecided "??")
;; ;;
@ -491,8 +494,9 @@ lines are selected, or the NxM dimensions of a block selection.")
(vc-mode (" " (vc-mode (" "
,(all-the-icons-octicon "git-branch" :v-adjust 0.0) ,(all-the-icons-octicon "git-branch" :v-adjust 0.0)
vc-mode " ")) vc-mode " "))
" " " "
+modeline-encoding +modeline-encoding
" "
(+modeline-checker ("" +modeline-checker " ")))) (+modeline-checker ("" +modeline-checker " "))))
(def-modeline! project (def-modeline! project