This is a Japanese input method for Emacs that depends on a service of Google. It does not require a native library/executable (unlike mozc.el), nor an offline dictionary (unlike ddskk). It is written in pure Emacs Lisp and depends on the internet.
About the name: Rìběn means Japan in Mandarin Chinese. Since this input method requires connection to Google, it is unlikely you can use it in the mainland China. You can use it in Japan and most of the other countries.
The goal of this project is to provide a Japanese input method that requires minimal dependencies but is still usable.
It is primarily intended for daily communication at work. Its features are limited, and you may find it difficult to produce exact transliteration you want to express. It is not a goal of this project to support authors of Japanese literature.
This repository currently contains two packages.
The first one is riben
package which consists of all elisp files but avy-riben.el
.
You can use the folowing recipe:
(riben :fetcher github :repo "akirak/emacs-dumb-japanese"
:files (:defaults (:exclude "avy-riben.el")))
The other is avy-riben
, which lets you jump to a point on a visible text using furigana.
It consists of a single file avy-riben.el
, and it depends on riben
and avy:
(avy-riben :fetcher github :repo "akirak/emacs-dumb-japanese"
:files ("avy-riben.el"))
riben
provides some features that depend on Google Translate.
To use those features, you have to install go-translate as well.
Below is an example:
;; These keybindings are optional
(define-key riben-mode-map (kbd "C-j") #'riben-dispatch)
(define-key riben-mode-map (kbd "C-S-j") #'riben-inc-counter)
(define-key riben-mode-map (kbd "q") #'riben-mode-disable)
(define-key riben-mode-map (kbd "@") #'riben-switch-to-english-mode)
;; Workaround for commands in `org-mode-map' and other maps.
(with-eval-after-load 'riben
(dolist (key (mapcar #'car riben-decode-punctuation-alist))
(define-key riben-mode-map (vector key) #'riben-self-insert-command)))
Switch to japanese-riben
input method, or turn on riben-mode
.
It transliterates the input when you press a comma, period, or space.
Alternatively, you can transliterate any Hiragana text in a buffer by selecting the text and running riben-dispatch
command.
If you neeed to type katakana, you can use riben-katakana-mode
.
You can also use japanese-katakana
input method which is built into Emacs, but it is not based on the same romaji scheme as riben.
You can also produce Katakana corresponding to an English word. For example, you can produce “コンポーネント” by typing “component”.
To use this feature, turn on riben-english-mode
, or run riben-switch-to-english-mode
when you are inside riben-mode
.
Type an English word, and it is translated into katakana when you press space.
riben-switch-to-english-mode
makes Emacs switch back to riben-mode
after translation, so it is convenient if you want to include foreign words in Japanese.
If the mode doesn’t provide translation for a word, you can add it manually using riben-english-register-katakana
.
It stores translations in a SQLite database.
If you press .
instead of space in riben-english-mode
, you can choose which Japanese translation to insert into the buffer.
This can be convenient if you don’t remember the Japanese translation for an English word.
avy-riben
command jumps the point to text using avy like avy-migemo does, but without dictionary files.
As mentioned above, this input method requires connection to a Google server.
It should also be noted that riben-mode
remaps self-insert-command
.
It does not work if you are using another minor mode that remaps self-insert-command
for letter keys, like lispy does.
I personally don’t take this issue seriously, because I have never experienced a situation where I need to write Japanese in emacs-lisp-mode
.
As far I know, there are a couple of Japanese input methods for Emacs that are actively developed:
Another option is rime-japanese, which is a schema for the RIME input engine, which is primarily developed for Chinese speaking people. PYIM supports rime, so it would be possible to use rime-japanese via pyim. Unfortunately, these options are relatively hard to set up, and it does not officially support Emacs 29 yet.
This project was originally inspired by the following projects:
There are some other features inspired by the following projects: