LoginSignup
2
3

More than 3 years have passed since last update.

Manjaro + Emacs な環境で日本語入力を行えるようにする一例

Last updated at Posted at 2019-08-14

Introduction

fcitx-mozc と emacs-mozc のコンフリクトがつらすぎたので、uim と emacs-mozc を使い始めた話

require

  • Emacs
  • Manjaro Linux (recommended: Budgie)
  • yay (for Download some packages from AUR)

やること

  • uim をインストールする
  • uim の入力方式の設定(Google-CGIAPI-JP を使います)
  • emacs-mozc-ut2 のインストール
  • emacs の設定

uim のインストール

sudo pacman -Syu uim

echo "Emacs*UseXIM: false" >> ~/.Xresources

echo "# uim
export GTK_IM_MODULE='uim'
export QT_IM_MODULE='uim'
uim-xim &
export XMODIFIERS='@im=uim'" >> ~/.xinitrc

uim-pref-gtk

uim の入力方式の設定(Google-CGIAPI-JP を使います)

image.png

  • 全体設定 -> 標準の入力方式を指定 -> Google-CGIAPI-Jp
  • 全体設定 -> 使用可能にする入力方式 -> 次のように厳選
     image.png

  • Google-CGIAPI-Jp キー設定2 -> [Google-CGIAPI-Jp] オン / オフ
    Emacs の文化に則って、CTRL-\ を入力にしました。

image.png

~/.xinitrc のリロードを行います。=>再起動してください。

emacs-mozc-ut2 のインストール

yay -G mozc-ut2
cd mozc-ut2
nano PKGBUILD

PKGBUILD を次のように変更してください。

# Maintainer: ponsfoot <cabezon dot hashimoto at gmail dot com>

##
## Build configuration 
##
## You can choose the input method framework to use either ibus and/or uim.
## If you will not be using ibus, comment out below.
# _ibus_mozc="yes"
## If you will be using uim, uncomment below.
# _uim_mozc="yes"

## If you will be using mozc.el on Emacs, uncomment below.
_emacs_mozc="yes"

## If you want to use 'kill-line' feature of uim, uncomment below.
#_kill_line="yes"
## NOTE: This option affects only for uim users.
##       Bcause this applies a patch to original mozc source,
##       there is a possibility to fail depends on the mozc version.

## ニコニコ大百科IME辞書 (NICONICOPEDIA IME dictionary, see below)
_NICODIC="true"

# ... 

emacs-mozc_NICODIC の行を有効にしました。

一応 uim-mozc もありますが、 Google CGIAPI Jp の方が優秀とかなんとか (使いたければコメントアウトを解放してください。)

makepkg -si

emacs の設定

emacs 側で mozc パッケージをインストールしてください。
例えば M-x package-install [RET] mozc でインストールされます。

emacs の設定ファイルに次の項目を足してください。特にspacemacs を使っている方は、~/.spacemacs#'dotspacemacs/user-config に追加します。

.spacemacs
(defun dotspacemacs/user-config ()
 ;; ...
 (require 'mozc)
 (setq default-input-method "japanese-mozc")
)

また spacemacs user は dotspacemacs-additional-packages に mozc を追加してください。

.spacemacs
dotspacemacs-additional-packages '(
    ;; ...
    mozc
    )

emacs の設定を反映してください。日本語入力環境が手に入ります。

image.png

所感

uim は... まあ慣れの問題ですね、多分

Google-CGIAPI-Jp の変換は今の所Mozcと張り合えるような気もする、という感じです。とりあえず困っていないのでしばらくはGoogle-CGIAPI-Jp を使ってみようかな、と思っています。

なにはともあれ、emacs-mozc がまともに動くようになったので満足です。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3