SVX日記

2004|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|09|10|11|12|
2024|01|02|03|04|

2007-12-17(Mon) Emacs + IIIMECF + ATOK X3 = シアワセ!?

  つーわけで、coLinuxのWhiteBoxEnterpriseLinux4上のEmacsから、ATOK X3 for Linuxを使う方法である。

  まずは、ATOKのインストール。

wbel4-co:/root/atok_install # tar xvfz atokx3.tar.gz
 
wbel4-co:/root/atok_install/ATOKX3 # ./setupatok.sh
This software is furnished under an end user agreement and may be used
or copied only in accordance with the terms of such license.
If you accept the terms of the license agreement,Please select "Yes".
If you do not accept the terms of the license agreement,Please select "No".
? (yes/no)yes
Preparing...                ########################################### [100%]
   1:iiimf-client-lib       ########################################### [100%]
Preparing...                ########################################### [100%]
   1:iiimf-gtk              ########################################### [100%]
Preparing...                ########################################### [100%]
   1:iiimf-protocol-lib     ########################################### [100%]
Preparing...                ########################################### [100%]
   1:iiimf-server           ########################################### [100%]
Preparing...                ########################################### [100%]
   1:iiimf-x                ########################################### [100%]
"/etc/gtk-2.0/i386-redhat-linux-gnu/gtk.immodules" will be changed.
Preparing...                ########################################### [100%]
   1:atokx                  ########################################### [100%]
Installation has been completed.

  状況によっては、既にインストールされているIIIMF関連パッケージが削除されるが、そのまま削除させておく。

  次はIIIMFの設定。ここは大いにハマった。というか、まずLinuxにおける、日本語入力システムの仕組みがサッパリわかってなかった。一応、オイラはLinuxで飯を食ってはいるが、ウチは主にサーバ用途として売っているから、X上の日本語入力に関する知識はゼロなのだ。

  いろいろ苦労して調べたところによるとEmacsとATOKの関係は「Emacs(エディタ)」 → (インクルード) → 「IIIMECF(Lispモジュール)」 → (TCP/IP) → 「IIIMF(入力メソッドデーモン)」 → (ダイナミックリンク) → 「ATOK(漢字変換システムライブラリ)」ということになっているらしい。Xで使う場合のことはよくわからんが、よく聞くSCIM-Anthyというのが、IIIMF-ATOKと同じ次元の概念ということになるな。

  IIIMECFは、UnixドメインかTCP/IPのどちらかでIIIMFと通信を行う……のだが、まず、IIIMFをどう起動していいものやらわからない。いろいろ試したところ、単にコマンドラインから「# iiimd」とやれば、デーモンとして起動するみたいだ。

  なお、通信はTCP/IPを選択した。というのも、TCP/IPであれば外部からのアクセスも可能であるから、複数のマシンでひとつの変換エンジンを共有できて便利だろう、という目論見からである。

  iiimdの設定は、以下のようにした。

wbel4-co:/etc/iiim # vi iiimd.xml.conf
 
wbel4-co:/etc/iiim # diff -c iiimd.xml.conf.org iiimd.xml.conf
*** iiimd.xml.conf.org  2007-11-17 12:00:00.000000000 +0900
--- iiimd.xml.conf      2007-12-23 01:27:26.000000000 +0900
***************
*** 7,17 ****
                       type ... tcp : child directives: <hostname>, <port>
                                unix: child directives: <file>
        -->
-       <!--
        <listen type="tcp">
!           <hostname>localhost</hostname>
            <port>9010</port>
        </listen>
        <listen type="unix">
            <file>/var/run/iiim/.iiimp-unix/9010</file>
        </listen>
--- 7,17 ----
                       type ... tcp : child directives: <hostname>, <port>
                                unix: child directives: <file>
        -->
        <listen type="tcp">
!           <hostname>0.0.0.0</hostname>
            <port>9010</port>
        </listen>
+       <!--
        <listen type="unix">
            <file>/var/run/iiim/.iiimp-unix/9010</file>
        </listen>
***************
*** 38,43 ****
--- 38,46 ----
            <acl type="permit">
                <hostname>127.0.0.1</hostname>
            </acl>
+           <acl type="permit">
+               <hostname>192.168.1.123</hostname>
+           </acl>
        </acls>
        <!--
            <auth> directive:

  とりあえず、以下のコマンドで起動して……

wbel4-co:/etc/iiim # iiimd

  ……ちゃんとポートが開いているか確認する。

wbel4-co:/etc/iiim # netstat -an | grep 9010
tcp        0      0 0.0.0.0:9010                0.0.0.0:*                   LISTEN

  次は、Emacsのインストール。ちょっと古いバージョンだが、ディスク上に置いてあったパッケージをそのまま使った。emacs-elをインストールするのは、IIIMFの動作に必要なMule-UCSモジュールが含まれているからである。

wbel4-co:/root # rpm -Uvh /mnt/bin2/WhiteBox/RPMS/emacs-21.3-19.EL.1.i386.rpm /mnt/bin2/WhiteBox/RPMS/emacs-common-21.3-19.EL.1.i386.rpm /mnt/bin4/WhiteBox/RPMS/emacs-el-21.3-19.EL.1.i386.rpm
警告: /mnt/bin2/WhiteBox/RPMS/emacs-21.3-19.EL.1.i386.rpm: V3 DSA signature: NOKEY, key ID 73307de6
Preparing...                ########################################### [100%]
   1:emacs-common           ########################################### [ 33%]
   2:emacs                  ########################################### [ 67%]
   3:emacs-el               ########################################### [100%]

  一応、Emacsが起動することだけは確認しておく。

wbel4-co:/root # emacs test.txt

  画像の説明

  やはり、Red HatのRPMパッケージは、限られた環境用に動作確認し「商品として」提供しているだけあって、何も考えずに利用でき、非常に安心して利用できる。

  次はIIIMECFのインストール。パッケージに添付のREADMEにしたがって、バイトコンパイル、インストールする。

wbel4-co:/root/atok_install # tar xvfz IIIMECF-0.73.tar.gz
 
wbel4-co:/root/atok_install/iiimecf # emacs -q --no-site-file -batch -l iiimcf-comp.el
Remove old byte-compiled files-----
Compiling 1st stage-----
While compiling the end of the data in file /root/atok_install/iiimecf/lisp/iiimp.el:
  ** The following functions are not known to be defined:
    find-coding-system, iiimp-coding-system-or-name-p,
    make-network-process, char-to-ucs, ucs-to-char
Wrote /root/atok_install/iiimecf/lisp/iiimp.elc
While compiling the end of the data in file /root/atok_install/iiimecf/lisp/iiimcf.el:
  ** The following functions are not known to be defined:
    event-to-character, character-to-event, event-key,
    dispatch-event, next-event,
    iiimcf-server-control-get-hotkeys-by-label
Wrote /root/atok_install/iiimecf/lisp/iiimcf.elc
While compiling iiimcf-UI-insert-preedit in file /root/atok_install/iiimecf/lisp/iiimcf-UI.el:
  ** reference to free variable jit-lock-first-unfontify-pos
  ** assignment to free variable jit-lock-first-unfontify-pos
Wrote /root/atok_install/iiimecf/lisp/iiimcf-UI.elc
While compiling the end of the data in file /root/atok_install/iiimecf/lisp/EIMIL.el:
  ** The following functions are not known to be defined:
    compiled-function-arglist, compiled-function-instructions,
    compiled-function-constants, compiled-function-stack-depth
Wrote /root/atok_install/iiimecf/lisp/EIMIL.elc
Wrote /root/atok_install/iiimecf/lisp/PCE.elc
While compiling the end of the data in file /root/atok_install/iiimecf/lisp/iiimcf-sc.el:
  ** The following functions are not known to be defined:
    line-number-at-pos, maker-position, mark-position
Wrote /root/atok_install/iiimecf/lisp/iiimcf-sc.elc
 
wbel4-co:/root/atok_install/iiimecf # mkdir -p /usr/share/emacs/site-lisp/iiimecf
 
wbel4-co:/root/atok_install/iiimecf # cp lisp/* /usr/share/emacs/site-lisp/iiimecf

  バイトコンパイルされたファイルがインストールされていることを確認する。

wbel4-co:/root/atok_install/iiimecf # ls /usr/share/emacs/site-lisp/iiimecf
合計 624
-rw-r--r--  1 root  root    44312 12月  9 08:54 iiimcf.el
-rw-r--r--  1 root  root    26937 12月  9 08:54 iiimcf-sc.el
-rw-r--r--  1 root  root    21739 12月  9 08:54 iiimcf-UI.el
-rw-r--r--  1 root  root    48519 12月  9 08:54 PCE.el
-rw-r--r--  1 root  root    28738 12月  9 08:54 EIMIL.el
-rw-r--r--  1 root  root    60143 12月  9 08:54 ChangeLog
-rw-r--r--  1 root  root    83174 12月  9 11:11 iiimp.el
-rw-r--r--  1 root  root   151532 12月 18 01:41 iiimp.elc
-rw-r--r--  1 root  root    33606 12月 18 01:41 iiimcf.elc
-rw-r--r--  1 root  root    17628 12月 18 01:41 iiimcf-UI.elc
-rw-r--r--  1 root  root    24439 12月 18 01:41 EIMIL.elc
-rw-r--r--  1 root  root    22077 12月 18 01:41 iiimcf-sc.elc
-rw-r--r--  1 root  root    37349 12月 18 01:41 PCE.elc

  IIIMECFがインストールできたところで、Emacsから呼び出す設定を行う。とりあえず、最初は試しにrootユーザに設定しよう。これも、IIIMECFに添付のREADMEの記述を参考に設定する。

wbel4-co:/root # vi .emacs
;; .emacs
 
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
 
;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
  (global-font-lock-mode t))
 
;; enable visual feedback on selections
;(setq transient-mark-mode t)
 
;; default to better frame titles
(setq frame-title-format
      (concat  "%b - emacs@" system-name))
 
(global-set-key "\C-h" 'delete-backward-char)
(global-set-key "\C-z" 'scroll-down)
(global-set-key "\C-u" 'undo)
(global-set-key "\C-]" 'call-last-kbd-macro)
 
(menu-bar-mode nil)
(column-number-mode t)
(setq blink-matching-paren nil)
 
(setq default-tab-width 4)
(setq default-fill-column 64)
(setq text-mode-hook 'turn-on-auto-fill)
 
(setq make-backup-files nil)
(setq auto-save-default nil)
 
;; ATOK X3 for Linux
(setq iiimcf-server-control-hostlist '("localhost:9010"))
(require 'iiimcf-sc)
(setq iiimcf-server-control-default-language "ja")
(setq iiimcf-server-control-default-input-method "atokx3")
(setq default-input-method 'iiim-server-control)
(define-key global-map "\C-q" 'toggle-input-method)

  冒頭は、WBELのEmacsパッケージのデフォルト設定。その後ろがオレ用設定。末尾の7行がIIIMECF用の設定なのだが、この設定を付加し、Emacsを起動、Ctrl+qでATOKを起動しようとすると……

Args out of range: 0, 9

  ……なんじゃ、このエラーは!? 今日はここまで。