dimanche 16 août 2015

Put readable file encoding and line endings mode in the mode-line

I was never able to decipher the default mode-line information about encoding/line endings so I changed it:

(defvar my-mode-line-coding-format
    (let* ((code (symbol-name buffer-file-coding-system))
           (eol-type (coding-system-eol-type buffer-file-coding-system))
           (eol (if (eq 0 eol-type) "UNIX"
                  (if (eq 1 eol-type) "DOS"
                    (if (eq 2 eol-type) "MAC"
      (concat code " " eol " "))))
(put 'my-mode-line-coding-format 'risky-local-variable t)
(setq-default mode-line-format (substitute 'my-mode-line-coding-format 'mode-line-mule-info mode-line-format))
Now you get "utf-8 UNIX" in place of the cryptic "U*:%" whatever bullshit it was.

Aucun commentaire:

Enregistrer un commentaire