help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Is it possible to use new Emacsen with non-ASCII?


From: Jason Rumney
Subject: Re: Is it possible to use new Emacsen with non-ASCII?
Date: Thu, 22 May 2008 16:07:39 -0700 (PDT)
User-agent: G2/1.0

On May 22, 9:26 pm, Ilya Zakharevich <address@hidden> wrote:

> >   emacs -q --no-site-file
> >   M-x set-language-environment RET Cyrillic-KOI8 RET
> >   C-x RET t Cyrillic-KOI8 RET
> >   C-x RET k Cyrillic-KOI8 RET
>
> I spoke too soon.  Typed literally, it works.  But the "equivalent"
> programmatic code does not:
>
> (let ((v (getenv "EMACS_LANGENV")))
>   (and v (progn
>            (set-language-environment v)
>            (set-terminal-coding-system (intern v))
>            (set-keyboard-coding-system (intern v))
>            (set-input-mode (car (current-input-mode))
>                            (nth 1 (current-input-mode))
>                            '8bit)
>            (run-with-idle-timer
>             5 nil 'message              ; Once, after 5 sec of inactivity
>             "Switch Cyr/Lat by Ctrl-\\, Cyr-Yawerty/Cyr-GOST by f9 \\"))))

Coding systems all have names that are lower-case. Interactively the
completion code will take care of the case conversion on input, but
programatically you'll have to downcase v before interning.

This will work for the Cyrillic-KOI8 language environment, and for a
few others where the language environment name matches the prefered
coding-system or an alias, but if you are looking for a more general
mechanism, I'd recommend using (car (get-language-info v 'coding-
priority)) as a more robust way to get the coding system from the
language environment. The downcase method will fail for language
environments like "Tajik", which specifes koi8-t as its prefered
coding-system (also "French", "German" etc which specify iso-latin-1).


reply via email to

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