all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jason Rumney <jasonrumney@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Is it possible to use new Emacsen with non-ASCII?
Date: Thu, 22 May 2008 16:07:39 -0700 (PDT)	[thread overview]
Message-ID: <bc82e254-8f58-4f79-9184-aecc6f65eabb@e53g2000hsa.googlegroups.com> (raw)
In-Reply-To: g14kuj$2gpu$1@agate.berkeley.edu

On May 22, 9:26 pm, Ilya Zakharevich <nospam-ab...@ilyaz.org> 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).


  parent reply	other threads:[~2008-05-22 23:07 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-15  0:37 Is it possible to use new Emacsen with non-ASCII? Ilya Zakharevich
2008-05-15  9:24 ` Jason Rumney
2008-05-15 18:02   ` Ilya Zakharevich
2008-05-15 19:06     ` Eli Zaretskii
2008-05-15 19:18       ` Eli Zaretskii
2008-05-15 19:33         ` Eli Zaretskii
     [not found]         ` <mailman.11649.1210880089.18990.help-gnu-emacs@gnu.org>
2008-05-16  7:29           ` Ilya Zakharevich
2008-05-16  8:58             ` Eli Zaretskii
     [not found]             ` <mailman.11665.1210928327.18990.help-gnu-emacs@gnu.org>
2008-05-16 11:20               ` Ilya Zakharevich
     [not found]     ` <mailman.11643.1210878436.18990.help-gnu-emacs@gnu.org>
2008-05-16  7:24       ` Ilya Zakharevich
2008-05-16  8:48         ` Eli Zaretskii
2008-05-15 11:14 ` Peter Dyballa
2008-05-15 13:44 ` Joel J. Adamson
     [not found] ` <mailman.11617.1210850110.18990.help-gnu-emacs@gnu.org>
2008-05-15 18:10   ` Ilya Zakharevich
2008-05-15 19:11     ` Eli Zaretskii
     [not found]     ` <mailman.11644.1210878709.18990.help-gnu-emacs@gnu.org>
2008-05-16  7:28       ` Ilya Zakharevich
2008-05-16  8:55         ` Eli Zaretskii
2008-05-16  9:27           ` Eli Zaretskii
     [not found]           ` <mailman.11667.1210930077.18990.help-gnu-emacs@gnu.org>
2008-05-16 11:16             ` Ilya Zakharevich
2008-05-16 11:56               ` Eli Zaretskii
2008-05-16 12:03                 ` Eli Zaretskii
     [not found]                 ` <mailman.11687.1210939428.18990.help-gnu-emacs@gnu.org>
2008-05-17  0:24                   ` Ilya Zakharevich
2008-05-17  7:26                     ` Eli Zaretskii
2008-05-19 13:40                     ` Chris McMahan
2008-05-19 18:57                       ` Eli Zaretskii
     [not found]                       ` <mailman.11853.1211223527.18990.help-gnu-emacs@gnu.org>
2008-05-20  2:33                         ` Ilya Zakharevich
2008-05-22 20:26                   ` Ilya Zakharevich
2008-05-22 22:09                     ` David Kastrup
2008-05-22 23:07                     ` Jason Rumney [this message]
2008-05-23  9:55                       ` Ilya Zakharevich
2008-05-23 10:59                         ` Jason Rumney
2008-05-24  6:58                           ` Ilya Zakharevich
2008-05-24 11:10                             ` Eli Zaretskii
     [not found]               ` <mailman.11686.1210938990.18990.help-gnu-emacs@gnu.org>
2008-05-17  0:21                 ` Ilya Zakharevich
2008-05-17  7:22                   ` Eli Zaretskii
     [not found]                   ` <mailman.11744.1211008926.18990.help-gnu-emacs@gnu.org>
2008-05-22 20:23                     ` Ilya Zakharevich
2008-05-23  8:59                       ` Eli Zaretskii
     [not found]                       ` <mailman.12090.1211533232.18990.help-gnu-emacs@gnu.org>
2008-05-23 10:00                         ` Ilya Zakharevich
     [not found]         ` <mailman.11664.1210928215.18990.help-gnu-emacs@gnu.org>
2008-05-16 11:15           ` Ilya Zakharevich
2008-05-16 11:50             ` Eli Zaretskii
     [not found]             ` <mailman.11681.1210938659.18990.help-gnu-emacs@gnu.org>
2008-05-17  0:17               ` Ilya Zakharevich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc82e254-8f58-4f79-9184-aecc6f65eabb@e53g2000hsa.googlegroups.com \
    --to=jasonrumney@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.