ui/modeline: add indent type+width to modeline
Also, display nothing for file encoding if encoding is undecided.
This commit is contained in:
parent
b697ad982e
commit
f8f9144f08
1 changed files with 14 additions and 10 deletions
|
@ -482,16 +482,20 @@ Meant for `+modeline-buffer-path-function'."
|
|||
|
||||
(def-modeline-segment! +modeline-encoding
|
||||
:on-hooks (after-revert-hook after-save-hook find-file-hook)
|
||||
:on-set (buffer-file-coding-system)
|
||||
(concat (pcase (coding-system-eol-type buffer-file-coding-system)
|
||||
(0 "LF ")
|
||||
(1 "CRLF ")
|
||||
(2 "CR "))
|
||||
(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)))))
|
||||
" "))
|
||||
:on-set (buffer-file-coding-system indent-tabs-mode tab-width)
|
||||
(concat (format (if indent-tabs-mode "⭾%d" "␣%d")
|
||||
tab-width)
|
||||
" "
|
||||
(pcase (coding-system-eol-type buffer-file-coding-system)
|
||||
(0 "LF")
|
||||
(1 "CRLF")
|
||||
(2 "CR"))
|
||||
" "
|
||||
(let* ((sys (coding-system-plist buffer-file-coding-system))
|
||||
(category (plist-get sys :category)))
|
||||
(cond ((eq category 'coding-category-undecided) "")
|
||||
((eq category 'coding-category-utf-8) "UTF-8 ")
|
||||
((concat (upcase (symbol-name (plist-get sys :name))) " "))))))
|
||||
|
||||
(def-modeline-segment! +modeline-major-mode
|
||||
(propertize (format-mode-line mode-name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue