From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.help Subject: Re: Is it possible to use new Emacsen with non-ASCII? Date: Thu, 22 May 2008 16:07:39 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1211499651 11915 80.91.229.12 (22 May 2008 23:40:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 May 2008 23:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 23 01:41:28 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JzKPY-0002Fa-9N for geh-help-gnu-emacs@m.gmane.org; Fri, 23 May 2008 01:41:28 +0200 Original-Received: from localhost ([127.0.0.1]:37464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JzKOn-0001zm-Qf for geh-help-gnu-emacs@m.gmane.org; Thu, 22 May 2008 19:40:41 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!e53g2000hsa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: 83.67.23.108 Original-X-Trace: posting.google.com 1211497660 27517 127.0.0.1 (22 May 2008 23:07:40 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 22 May 2008 23:07:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e53g2000hsa.googlegroups.com; posting-host=83.67.23.108; posting-account=pYxWjwkAAACsHSUNDoi5N05LVCTP7PVM User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:158887 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:54253 Archived-At: On May 22, 9:26 pm, Ilya Zakharevich 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).