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

Re: Coding systems



On 2018-02-19 11:25, Katsumi Yamaoka wrote:
> In [emacs-w3m:12914]
> On Sun, 18 Feb 2018 06:42:22 -0500, Boruch Baum wrote:
>> ...
> I think it is good to make all the ^w3m.+coding-system variables,
> except the ones that should inherit system's locale, be utf-8.
> A coding system such as utf-8 that can be used to encode/decode
> any charset was not generalized in the Emacs world when we started
> emacs-w3m, so we used iso-2022-7bit, etc. then instead.
>
> But we should be very careful if we change those default values.

I thought now that at install, emacs-w3m could define the user-default
for these variables based upon the system ${LC_CTYPE}, using a set of
(cond ... ) clauses, so I looked into how to use elisp to retrieve that,
which turned out to be variable `locale-coding-system' and function
`(locale-info 'codeset)'[1]. More interesting though , is that since
emacs-w3m was originally developed, emacs has come up with its own
native set of variables and functions almost identical to the emacs-w3m
ones, for coding systems and input methods[2]!

Here is a first-look attempt at correspondence between emacs-w3m
variables and (new) emacs native ones:


> LC_CTYPE="ja_JP.UTF-8"
(locale-info 'codeset)


> LC_TIME="C"
system-time-locale
(locale-info 'months)
(locale-info 'days)


> LC_MESSAGES="C"
system-messages-locale


> w3m-file-coding-system
>  iso-2022-7-bit
> w3m-bookmark-file-coding-system
>  euc-japan
> w3m-form-textarea-file-coding-system
>  iso-2022-7-bit-ss2
default-file-name-coding-system
file-name-coding-system



> w3m-default-coding-system
>  shift_jis
> w3m-coding-system
>  iso-2022-7-bit
> w3m-input-coding-system
>  utf-8
> w3m-output-coding-system
>  utf-8
default-process-coding-system
default-sendmail-coding-system
default-buffer-file-coding-system
default-keyboard-coding-system


> w3m-terminal-coding-system
>  euc-japan
default-terminal-coding-system


Here are some of the current emacs variables for input method:

    input-method-alist
    current-input-method
    default-input-method

    input-method-history

    toggle-input-method-active

    deactivate-current-input-method-function
    inactivate-current-input-method-function
    input-method-exit-on-first-char
    input-method-exit-on-invalid-key
    isearch-input-method-function
    input-method-after-insert-chunk-hook
    input-method-function
    input-method-inactivate-hook
    input-method-activate-hook
    input-method-deactivate-hook

So, at this point, the way to go may be to set the default emacs-w3m
values at install based upon the native emacs ones (ie, not my first
idea of using a generalized set of (cond ...) clauses. That could be
done in the relevant defvar functions.

This would be a great usability enhancement for any new emacs-w3m user
whose defaults aren't latin-1.

[1] https://www.gnu.org/software/emacs/manual/html_node/elisp/Locales.html
[2] https://www.gnu.org/software/emacs/manual/html_node/elisp/Non_002dASCII-Characters.html

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0