ibus.el is IBus client for GNU Emacs.

ibus.el provides ibus-mode minor mode, which allows users on-the-spot style input with IBus on Emacs. The input statuses are individually kept for each buffer, and prefix-keys such as C-x and C-c can be used even if IBus is active. So you can input various languages fast and comfortably.


System requirements

emacs22 or emacs23
python (>= 2.5)
ibus (>= 1.2)


You can download ibus.el from ibus.el project in Launchpad
If you use Ubuntu Linux, you can install ibus-el package from PPA for Irie's Elisp


Manual Installation

Save ibus.el and byte-compile in a directory that is listed in load-path, and save ibus-el-agent somewhere in your system.
Put the following in your .emacs file:
        (require 'ibus)
        (add-hook 'after-init-hook 'ibus-mode-on)
If ibus.el and ibus-el-agent are saved in different directories, add a setting to the above as follows:
        (setq ibus-agent-file-name "/PATH/TO/ibus-el-agent")

Using deb package in PPA

Add ppa:irie/elisp to software sources:
        sudo add-apt-repository ppa:irie/elisp
        sudo apt-get update
and install ibus-el package:
        sudo apt-get install ibus-el
Put the following in your .emacs file:
        (require 'ibus)
        (add-hook 'after-init-hook 'ibus-mode-on)

Disabling XIM

If XIM is enabled, key events are directly handled by IBus so ibus.el can’t work.
To disable XIM in Emacs, put the following in ~/.Xresources file:
        Emacs*useXIM: false
and restart X session or execute a shell command:
        xrdb ~/.Xresources


Here is the example of .emacs file:
        (require 'ibus)
        ;; Turn on ibus-mode automatically after loading .emacs
        (add-hook 'after-init-hook 'ibus-mode-on)
        ;; Use C-SPC for Set Mark command
        (ibus-define-common-key ?\C-\s nil)
        ;; Use C-/ for Undo command
        (ibus-define-common-key ?\C-/ nil)
        ;; Change cursor color depending on IBus status
        (setq ibus-cursor-color '("red" "blue" "limegreen"))
If you use the client-server mode of emacs, replace the after-init-hook line by this:
        (add-hook 'after-make-frame-functions
	  (lambda (new-frame)
	    (select-frame new-frame)
	    (or ibus-mode (ibus-mode-on))))
If your distribution uses Python 3 by default, please customize the variable “ibus-python-shell-command-name” to “python2”.
You can customize keybinding which toggles input status:
        ;; Use S-SPC to toggle input status
        (ibus-define-common-key ?\S-\s nil)
        (global-set-key (kbd "S-SPC") 'ibus-toggle)

Using ibus-anthy

To toggle half-width eisu mode by C-j, add the following to .emacs:
        (ibus-define-common-key ?\C-j t)
To use kana input method with jp106 keyboard, you can enable kana onbiki (prolonged sound mark) key as follows:
        (setq ibus-use-kana-onbiki-key t)
If you use thumb shift input method, you have to specify the simultaneous pressing time as:
        (setq ibus-ibus-simultaneous-pressing-time 0.1)

Using ibus-chewing

Please set input style to “in application window” in ibus-chewing’s configuration dialog.

Using ibus 1.5 with emacs

The interface python-ibus is broken with ibus 1.5, and the emacs interface ibus.el is non longer usable.

We can continue to use emacs with ibus letting the XIM do the input, we need to use as resource:

    Emacs*useXIM: true

and launch emacs with an existing asian locale like

    LANG="ja_JP.UTF-8" emacs

Also choose an input method switching key that is not bound in emacs. Ctrl-space is usually a bad choice better use Ctrl-Shift-space or what is convenient for your desktop.

Note that if you launch emacs with an uninstalled locale, even if you have the fonts needed for the typed character you will only see the precompose popup, but no input.

Also Emacs has some idea of what is asian, I needed mainly to input tibetan characters so I tried to launch emacs with the Dzonkha locale dz_BT.utf8, but it does not work, I was obliged to install japanese and launch emacs as above to input tibetan!