unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* OSX terminal, system-wide Chinese input methods
@ 2008-11-21  4:37 Eric Abrahamsen
  2008-11-21 10:15 ` Peter Dyballa
       [not found] ` <mailman.929.1227262522.26697.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2008-11-21  4:37 UTC (permalink / raw)
  To: help-gnu-emacs

Hi there,

I'm having a Unicode-related problem which is particularly annoying  
for being mysterious and only occasional. I use Emacs via Mac OSXs  
terminal app. I do Chinese text entry using the QIM input method,  
which is system-wide, under the input methods menu. MOST of the time,  
Chinese input works correctly in Emacs, while sometimes it comes out  
garbled. Pasting Chinese text into those buffers also result in  
garbled text. Buffers sometimes start out garbled, but after I fiddle  
around for a while, Chinese input suddenly works (it's never gone in  
the other direction). I'm never really sure what I've done to get it  
working, but it seems that newly-created buffers have this problem  
more, while opening files that already have Chinese text in them never  
causes problems. I use QIM for all programs and don't want to use the  
Emacs-native input methods. This is my Emacs version:

GNU Emacs 22.3.1 (powerpc-apple-darwin9.4.0, Carbon Version 1.6.0)

And I've got the following in my .emacs file:

(set-language-environment 'UTF-8)

I also tend to use the TeX input method when editing text-based files.

I ran describe-coding-environment on two different buffers, the first  
where Chinese input wasn't working, the second on a buffer where it  
was. There's hardly any difference between the two, but I also noticed  
that, after doing this, Chinese input HAD started working in the first  
buffer, so maybe this is already meaningless. You can see my  
confusion...

Thanks in advance for any hints,

Eric


Originally NOT working:

Coding system for saving this buffer:
   u -- mule-utf-8 (alias: utf-8)

Default coding system (for new files):
   u -- mule-utf-8 (alias: utf-8)

Coding system for keyboard input:
   u -- utf-8 (alias of mule-utf-8)

Coding system for terminal output:
   u -- utf-8 (alias of mule-utf-8)


Working from the start:

Coding system for saving this buffer:
   u -- mule-utf-8-unix

Default coding system (for new files):
   u -- mule-utf-8 (alias: utf-8)

Coding system for keyboard input:
   u -- utf-8 (alias of mule-utf-8)

Coding system for terminal output:
   u -- utf-8 (alias of mule-utf-8)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OSX terminal, system-wide Chinese input methods
  2008-11-21  4:37 OSX terminal, system-wide Chinese input methods Eric Abrahamsen
@ 2008-11-21 10:15 ` Peter Dyballa
       [not found] ` <mailman.929.1227262522.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2008-11-21 10:15 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: help-gnu-emacs


Am 21.11.2008 um 05:37 schrieb Eric Abrahamsen:

> (set-language-environment 'UTF-8)


It might be better not to use this statement but have in the shell  
from which you launch Carbon Emacs environment variables LANG and  
LC_CTYPE which are set to some Chinese UTF-8 value, zh_TW.UTF-8,  
zh_HK.UTF-8, zh_CN.UTF-8 – or can zh_CN.GB18030, zh_CN.GB2312,  
zh_CN.GBK be more appropriate?

Set-language-environment has many side-effects. If you're not content  
with the new setup, you can use statements like

	(prefer-coding-system 'utf-8-unix)
	(prefer-coding-system 'utf-8)
	(prefer-coding-system 'utf-8m)

etc. to help Emacs do the right thing.

--
Greetings

   Pete

Computers are good at following instructions, but not at reading your  
mind.
	- D. E. Knuth, The TeXbook, Addison-Wesley 1984, 1986, 1996, p. 9







^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OSX terminal, system-wide Chinese input methods
       [not found] ` <mailman.929.1227262522.26697.help-gnu-emacs@gnu.org>
@ 2008-12-03 10:10   ` 锁住子
  2008-12-03 15:11     ` Peter Dyballa
       [not found]     ` <mailman.1838.1228317129.26697.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: 锁住子 @ 2008-12-03 10:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 21, 6:15 pm, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> Am 21.11.2008 um 05:37 schrieb Eric Abrahamsen:
>
> > (set-language-environment 'UTF-8)
>
> It might be better not to use this statement but have in the shell  
> from which you launch Carbon Emacs environment variables LANG and  
> LC_CTYPE which are set to some Chinese UTF-8 value, zh_TW.UTF-8,  
> zh_HK.UTF-8, zh_CN.UTF-8 – or can zh_CN.GB18030, zh_CN.GB2312,  
> zh_CN.GBK be more appropriate?
>
> Set-language-environment has many side-effects. If you're not content  
> with the new setup, you can use statements like
>
>         (prefer-coding-system 'utf-8-unix)
>         (prefer-coding-system 'utf-8)
>         (prefer-coding-system 'utf-8m)
>
> etc. to help Emacs do the right thing.

I think I've figured out another level to this problem -- when Chinese
input isn't working right, and then I use find-file to navigate into a
directory which is named in Chinese, I see the following in
*Messages*:

loading subst-gb2312...
loading subst-jis...

and a few other lines of that ilk, following which everything works
correctly. I've tried directly evaluating (load subst-gb2312) etc,
which simply produces an error. Does anyone know what this subst-*
means, and how I can load it automatically as a text-mode hook?

Thanks, Eric

>
> --
> Greetings
>
>    Pete
>
> Computers are good at following instructions, but not at reading your  
> mind.
>         - D. E. Knuth, The TeXbook, Addison-Wesley 1984, 1986, 1996, p. 9



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OSX terminal, system-wide Chinese input methods
  2008-12-03 10:10   ` 锁住子
@ 2008-12-03 15:11     ` Peter Dyballa
       [not found]     ` <mailman.1838.1228317129.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2008-12-03 15:11 UTC (permalink / raw)
  To: 锁住子; +Cc: help-gnu-emacs


Am 03.12.2008 um 11:10 schrieb 锁住子:

> I've tried directly evaluating (load subst-gb2312) etc,

Have also tried load-library?

The subst-* files are directly loaded by GNU Emacs, they are loaded  
*before* the system init file.

--
Greetings

   Pete

UNIX is user friendly, it's just picky about who its friends are.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OSX terminal, system-wide Chinese input methods
       [not found]     ` <mailman.1838.1228317129.26697.help-gnu-emacs@gnu.org>
@ 2008-12-03 15:55       ` poppyer
  2008-12-03 18:25         ` Peter Dyballa
       [not found]         ` <mailman.1864.1228328775.26697.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: poppyer @ 2008-12-03 15:55 UTC (permalink / raw)
  To: help-gnu-emacs


Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 03.12.2008 um 11:10 schrieb 锁住子:
>
>> I've tried directly evaluating (load subst-gb2312) etc,
>
> Have also tried load-library?
>
> The subst-* files are directly loaded by GNU Emacs, they are loaded
> *before* the system init file.

try (load "subst-gb2312") as well.
But Peter is absolutely right. if you set your LC_CTYPE/LANG correctly
to a chinese one, say zh_CN.UTF8. 
It will be automatically loaded *before* system init
(which means you should see it at *message* when you startup your emacs)
So, check your LC_CTYPE first.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OSX terminal, system-wide Chinese input methods
  2008-12-03 15:55       ` poppyer
@ 2008-12-03 18:25         ` Peter Dyballa
       [not found]         ` <mailman.1864.1228328775.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Peter Dyballa @ 2008-12-03 18:25 UTC (permalink / raw)
  To: poppyer, 锁住子 Abrahamsen; +Cc: help-gnu-emacs


Am 03.12.2008 um 16:55 schrieb poppyer:

> if you set your LC_CTYPE/LANG correctly
> to a chinese one, say zh_CN.UTF8.
> It will be automatically loaded *before* system init

And it's not necessary to set these two environment variables system- 
wide, which might effect also other applications. On the command line  
it's possible to type cautiously:

	env LANG=... LC_CTYPE=... <some command> [&]

(``[&]´´ stands for optional parameter, i.e., when you end your  
command with ``&´´ the programme will be sent into the background and  
the shell will be open for new input, but it's no must, and you can  
correct this later when needed)

If this seems to be too complicated you can also use a shell script.  
In Mac OS X, to launch an application bundle, you could either:

	#!/bin/bash
	export LANG=... LC_CTYPE=...
	open /Applications/<name of application>.app

or

	#!/bin/bash
	env LANG=... LC_CTYPE=... open /Applications/<name of application>.app

The latter, i.e., the last line, can also be used on the command line  
and you could also use it in AppleScript to launch a Carbon or a  
Cocoa Emacs from a menu.

--
Greetings

   Pete

One cannot live by television, video games, top ten CDs, and dumb  
movies alone.
				– Amiri Baraka, 1999







^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: OSX terminal, system-wide Chinese input methods
       [not found]         ` <mailman.1864.1228328775.26697.help-gnu-emacs@gnu.org>
@ 2008-12-04  0:44           ` 锁住子
  0 siblings, 0 replies; 7+ messages in thread
From: 锁住子 @ 2008-12-04  0:44 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 4, 2:25 am, Peter Dyballa <Peter_Dyba...@Web.DE> wrote:
> Am 03.12.2008 um 16:55 schrieb poppyer:
>
> > if you set your LC_CTYPE/LANG correctly
> > to a chinese one, say zh_CN.UTF8.
> > It will be automatically loaded *before* system init
>
> And it's not necessary to set these two environment variables system-
> wide, which might effect also other applications.

Yes, the only reason I was still fooling with this was that it was a
bit problematic having the language set system-wide. Setting the
variables just prior to launching emacs ought to be fine – anyway, now
that I've got a better understand of how all this works, I'm sure it
will be easy to find an appropriate solution. (And yes, it was (load-
library "subst-gb2312"))

Thank you both for the help!

Eric

On the command line  
> it's possible to type cautiously:
>
>         env LANG=... LC_CTYPE=... <some command> [&]
>
> (``[&]´´ stands for optional parameter, i.e., when you end your  
> command with ``&´´ the programme will be sent into the background and  
> the shell will be open for new input, but it's no must, and you can  
> correct this later when needed)
>
> If this seems to be too complicated you can also use a shell script.  
> In Mac OS X, to launch an application bundle, you could either:
>
>         #!/bin/bash
>         export LANG=... LC_CTYPE=...
>         open /Applications/<name of application>.app
>
> or
>
>         #!/bin/bash
>         env LANG=... LC_CTYPE=... open /Applications/<name of application>.app
>
> The latter, i.e., the last line, can also be used on the command line  
> and you could also use it in AppleScript to launch a Carbon or a  
> Cocoa Emacs from a menu.
>
> --
> Greetings
>
>    Pete
>
> One cannot live by television, video games, top ten CDs, and dumb  
> movies alone.
>                                 – Amiri Baraka, 1999



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-12-04  0:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21  4:37 OSX terminal, system-wide Chinese input methods Eric Abrahamsen
2008-11-21 10:15 ` Peter Dyballa
     [not found] ` <mailman.929.1227262522.26697.help-gnu-emacs@gnu.org>
2008-12-03 10:10   ` 锁住子
2008-12-03 15:11     ` Peter Dyballa
     [not found]     ` <mailman.1838.1228317129.26697.help-gnu-emacs@gnu.org>
2008-12-03 15:55       ` poppyer
2008-12-03 18:25         ` Peter Dyballa
     [not found]         ` <mailman.1864.1228328775.26697.help-gnu-emacs@gnu.org>
2008-12-04  0:44           ` 锁住子

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).