Getting IBus working with Emacs
来源:互联网 发布:qtassist是什么软件 编辑:程序博客网 时间:2024/06/02 19:21
Getting IBus working with Emacs
In emacs.
tags: emacs
Emacs comes with a lot of Chinese input methods like pinyin,four-corner method, and variousforms ofCangjie among others(listed quite handily here). Forbasic usage, it actually does fairly well. I've been able to use thefour corner method to look up characters of which I don't know thepronunciation. However, Emacs's 4corner and Cangjie methods arelimited in that they only use traditional characters and can't look upsimplified characters. So if I tried to look up 龙 ("dragon"), whichlooks like 4corner "43040" to me, I wouldn't be able to, since it's asimplified character. I'd only be able to look up the traditional formof dragon: "龍" (which is "01211"). So I looked for other inputmethods that might support both traditional and simplified, one ofwhich is Wubi. Wubi isn't available for Emacs, but can be installedviaIBus.
I installed IBus and tried it out. It's input is pretty good, andbetter than Emacs's pinyin in that it has phrase matching. So if Iwanted to enter in "lǎoshī" ("teacher", "老师") in Emacs, it wouldget "lao -> 老" correct, but would guess that "shi" is "是", sinceshì (是) is more common than shī (师). IBus's pinyin is smart enoughto recognize "laoshi" as "老师", among other words and phrases.
IBus worked out of the box for applications like Chromium and evenxterm, but for some reason it seemed to have no effect whatsoever inEmacs. I thought this had something to do with not havingibus-el installed, so I installed it viaapt. Even with correct setup I still had problems. Nothing was showingup. When I triedibus-toggle I got the error'IBusELInputContext' object has no attribute 'enable'. It turnsout that IBus 1.5 no longer works with ibus-el, and that ibus-elpretty much doesn't work anymore (seethis discussion). But some seemed to be able to get IBus working without ibus-el. Since Emacs has XIM support, it should be able to support it automatically. But whenever I entered text, only English characters appeared, without the IBus character selection dialog popup. I tried adding
export GTK_IM_MODULE=ibusexport XMODIFIERS=@im=ibusexport QT_IM_MODULE=ibus
to my ~/.zshrc (it turns out you probably don't need to, asGTK_IM_MODULE andXMODIFIERS were already set to these values).
I found someone mention the workaround of using LC_CTYPE="zh_CN.UTF-8" emacs to start Emacs.It turns out that this somewhat works. I started to see the IBus character selection dialog popup, but I wasn't able to enter any characters. I tracked the problem to Gtk-WARNING **: Locale not supported by C library, which suggested that I didn't actually have "zh_CN.UTF-8" installed. So I installed it viasudodpkg-reconfigure locales and selected the appropriate option. Now if I start emacs using
LC_CTYPE="zh_CN.UTF-8" emacs
it can accept input through Wubi, Pinyin, Cangjie5, and others. Cool!
There's still some problems with using IBus on Emacs without ibus-el. It's hard to do commands likeC-x k (kill-buffer) without thek being read as something else. Usually you have to switch to temporary English mode using Shift, or switch back to the US keyboard. Maybe someday ibus-el will work with IBus again, but the API conflicts seem to suggest this won't happen anytime soon.
Anyways, that's it. Hopefully this helps if you with Emacs and IBus if you were tearing your hair out like I was. 再见!
补充:
ibus需使用-x (xim模式启动),命令: ibus-daemon -drx
如果使用plink 远程启动,pink不会source .bashrc,需在命令中建立环境变量及启动ibus,也在系统中建如下脚本执行:
#!/bin/bashexport GTK_IM_MODULE=ibusexport XMODIFIERS=@im=ibusexport QT_IM_MODULE=ibusibus-daemon -drxsleep 2emacs
- Getting IBus working with Emacs
- Getting Smack working with Android 1.5 SDK.
- Emacs学习笔记 hour3 Getting Started with Emacs
- Develop--Training(六)Getting Started--Working with System Permissions
- emacs 使用ibus拼音输入法
- emacs添加ibus输入法
- Working harder, getting stronger!
- Android doc|Getting Started| Training部分 --翻译 Working with System Permissions
- getting CVS Emacs 23
- EMACS getting started
- emacs中无法启动ibus解决方法
- Linux下让emacs使用ibus输入法
- 设置Emacs中文输入法为IBus
- 英文环境下Emacs使用ibus输入法
- Getting Android SDK working on Ubuntu 64
- Getting Groovy with XML
- Getting Started with Smartphone
- Getting Started With JasperReports
- Sublime text3 安装插件
- 有向图强连通分量tarjan算法模板
- 黑马程序员---享元模式
- memset函数详解
- android 软件安装到内存还是sd卡?
- Getting IBus working with Emacs
- Jquery插件
- ubuntu编译环境中文英文切换
- 10 使用合并文件存储trunk_file
- 一些开发可以用到的网址
- 查找 EXC_BAD_ACCESS 问题根源的方法
- 不同浏览器引用不同JS
- Image upload in ADF
- UINavigationBar导航栏相关设置