git clone 'git://github.com/wsgac/kanji-mode.git'
This is a minor mode for GNU Emacs aiming to address a common need of Japanese language learners - getting the stroke order of a particular Kanji sign. It has a built-in collection of SVG images depicting stroke orders for all Kanji. The collection is a slightly modified and limited version of the SVGs provided by the KanjiVG project. The mode's operation is pretty simple. It retrieves the Unicode code of the character under the Emacs cursor and uses it to retrieve the proper SVG file (the files are happily named using Unicode numbers). It then displays the relevant SVG in a transient buffer.
Kanji-mode is available on MELPA to be installed via
package.el. If you have
MELPA configured as package repository, just run M-x package-install and enter “kanji-mode”. You can also select it for installation while browsing the package list after running M-x package-list-packages.
To install manually
kanji-mode download this repository somewhere you keep your Emacs modes (I keep it under
~/.emacs.d/). Then follow these simple steps:
* Make sure the
kanji-mode directory is part of your Emacs
load-path. You can do it by adding the following line to your
.emacs configuration file:
(add-to-list 'load-path "/path/to/your/kanji-mode")
kanji-mode by adding the following to
kanji-mode adds a hook to
text-mode, so it should launch automatically whenever you edit a text file. If you need it in other circumstances (temporary buffers, etc.), you can always launch it manually by hitting M-x and entering “kanji-mode”.
kanji-mode is active, you should be able to see the string “kanji” in the minor mode list in the buffer mode line at the bottom. Whenever you want to check the stroke order for a character under the cursor, hit M-s M-o (I tried to make this keybinding intuitively suggest “stroke order”) and a new buffer will appear, containing the image of your character with its stroke order. When you're done viewing it, hit q to close the buffer and return to your text. Below are two screenshots showing an example usage:
I'd like to thank Ulrich Apel and all contributors of the KanjiVG project for doing the meticulous work I'd never have the patience to do. I've only made small changes to their files (added a white background so it works well with dark Emacs themes and incresed the size to make it more legible) and dropped variants (Kaisho, etc.) since they were unusable in my mode.