Configuring Japanese input in Emacs using Anthy

When writing Japanese under Ubuntu, I use Anthy (one of popular Japanese input systems) with IBus (Intelligent Input Bus for Linux / Unix OS) input method for all X applications but Emacs. Interestingly, there seems to be no IBus interfaces available to Emacs at this moment. For Emacs, I use Anthy through anthy.el interface, which seems to be the most common option when writing Japanese under Emacs. In this post, I summarize how to configure Japanese input with Anthy under Emacs.

Japanese input by Anthy

Method

First, install Anthy and its interface for Emacs:

$ sudo apt-get install anthy anthy-el

Then, edit .emacs.el (the default configuration file of Emacs) to add the following block (bold lines are comments):

; Set load path for anthy.el
(push "/usr/share/emacs/site-lisp/anthy/" load-path)

; Load anthy.el
(load-library "leim-list")
(load-library "anthy")

;; Workarounds and customizations

; Fix slow input response in emacs23
(if (>= emacs-major-version 23)
(setq anthy-accept-timeout 1))

; Set japanese-anthy as the default input-method
(setq default-input-method "japanese-anthy")

; Shift-space to toggle anthy-mode (default is Ctrl-\)
(global-set-key (kbd "S-SPC") 'anthy-mode)

; Map wide-space to hankaku-space
(setq anthy-wide-space " ")

Finally, re-start Emacs and you can invoke anthy-mode by Shift-space. Enjoy writing Japanese!

Nike Shox R4

Do you want to make your life happy? Do you want to make your foot comfortable and you are in a good humor in a whole day? Nobody can unwillingness includ you! Ok, welcome to our Nike Shox R4 or Nike Shox Deliver website, we provied many highly quality but substantial price for every customer. Here will change your life! Thank you!