0

I’m trying to save space in my mode-line. 99% of the files I edit are in UTF-8 format with Unix line endings (coding system utf-8-unix). I don’t need the ‘U’/‘U:’ indicator in my mode-line in these cases, but I would like it to be there (in a warning face if possible) if I’m editing a file in any other coding system.

How can I hide this in my mode line only if it’s utf-8-unix? (FWIW I’m using smart-mode-line, if that helps.)

1 Answer 1

1

Here is what you could use to customize the mode-line coding indicator:

(setq-default
 mode-line-mule-info
 `(""
   (current-input-method
    (:propertize ("" current-input-method-title)
                 local-map ,mode-line-input-method-map
                 mouse-face mode-line-highlight))
   (:eval
    (propertize
     (cond
      ((memq buffer-file-coding-system '(utf-8-unix)) "")
      (t (propertize "%z" 'face 'warning)))
     'help-echo 'mode-line-mule-info-help-echo
     'mouse-face 'mode-line-highlight
     'local-map mode-line-coding-system-map))
   (:eval (mode-line-eol-desc))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.