From f075c3071060a8dcf091291628d323df8d8ee6f4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 21 Dec 2019 01:38:43 -0500 Subject: [PATCH] ui/modeline: refactor encoding segment --- modules/ui/modeline/+light.el | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/ui/modeline/+light.el b/modules/ui/modeline/+light.el index 6e1523737..ffca6f15c 100644 --- a/modules/ui/modeline/+light.el +++ b/modules/ui/modeline/+light.el @@ -464,16 +464,19 @@ lines are selected, or the NxM dimensions of a block selection.") ;;; `+modeline-encoding' (def-modeline-var! +modeline-encoding '(:eval - (concat (pcase (coding-system-eol-type buffer-file-coding-system) - (0 " LF ") - (1 " RLF ") - (2 " CR ")) + (concat (coding-system-eol-type-mnemonic buffer-file-coding-system) + " " (let ((sys (coding-system-plist buffer-file-coding-system))) (if (memq (plist-get sys :category) '(coding-category-undecided coding-category-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 (" " ,(all-the-icons-octicon "git-branch" :v-adjust 0.0) vc-mode " ")) - " " + " " +modeline-encoding + " " (+modeline-checker ("" +modeline-checker " ")))) (def-modeline! project