emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disambiguate modeline character for UTF-8?


From: Juri Linkov
Subject: Re: Disambiguate modeline character for UTF-8?
Date: Mon, 24 Aug 2020 21:35:56 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> I don't see a strong reason to limit ourselves to a single char, FWIW,
>> so I think `u7` is fine for utf-7* (it should be very rare anyway).
>
> It must be a single character, but OTOH it doesn't have to be an ASCII
> character.

I don't know where the requirement for a single character comes from,
but since I can't memorize these cryptic characters, I customized
the mode-line to display coding names in full, except a few characters
that I can remember: "U" for UTF-8, and "-" for ASCII:

;; This fix uses mnemonics only for known codings that are frequently used.
;; Otherwise, it displays the full name of the codings.
(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
                   ((not (memq buffer-file-coding-system
                               '(no-conversion
                                 undecided-unix
                                 prefer-utf-8-unix
                                 utf-8
                                 utf-8-dos
                                 utf-8-emacs
                                 utf-8-emacs-dos
                                 utf-8-emacs-unix
                                 utf-8-unix)))
                    (replace-regexp-in-string
                     "-\\(?:dos\\|unix\\)$" ""
                     (format "%S" buffer-file-coding-system)))
                   (t "%z"))
                  '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))))

A long coding string in the mode-line also serves as a warning that
a non-standard coding is used in the buffer.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]