;;  Copyright 1994 NEC Corporation, Tokyo, Japan.
;;  
;;  Permission to use, copy, modify, distribute and sell this software
;;  and its documentation for any purpose is hereby granted without
;;  fee, provided that the above copyright notice appear in all copies
;;  and that both that copyright notice and this permission notice
;;  appear in supporting documentation, and that the name of NEC
;;  Corporation not be used in advertising or publicity pertaining to
;;  distribution of the software without specific, written prior
;;  permission.  NEC Corporation makes no representations about the
;;  suitability of this software for any purpose.  It is provided "as
;;  is" without express or implied warranty.
;;  
;;  NEC CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
;;  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN 
;;  NO EVENT SHALL NEC CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
;;  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 
;;  USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 
;;  OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
;;  PERFORMANCE OF THIS SOFTWARE. 

;; Using this customize file gives you a Japanese Input Interface
;; like WXII+ does.

;;  $Id: wx2+.canna,v 1.1.1.1 2002/10/19 08:27:53 aida_s Exp $ 

;;; ローマ字かな変換の設定

(setq romkana-table "wx2+.cbp")


;;; 利用する辞書

(use-dictionary
 "iroha"
 "fuzokugo"
 "hojomwd"
 "hojoswd"
 :bushu "bushu"
 :user  "user"
 )


;;日本語入力 on にする。
(set-key 'alpha-mode "\C-Xfer" 'japanese-mode)

; 右端で右に行こうとすると左端にいく。
(setq cursor-wrap            t)         ; default t

; 文節の右端で右移動をすると全文が確定する。
(setq kakutei-if-end-of-bunsetsu t)     ; default nil

; 2 回変換キーを押すと一覧表示を行う。
(setq n-henkan-for-ichiran   2)         ; default 2	

; 候補が全体の何番目かを表示する。
(setq kouho-count            t)         ; default t

; 一覧表示で数字を打ったときにカーソル移動にとどめる。
(setq select-direct          nil)       ; default t

; 一覧表示で数字で選択する。
(setq numerical-key-select   t)         ; default t

;一覧から選択を行うと一つ先の文節に移動する。
(setq stay-after-validate    nil)       ; default t

; 一覧の最後までいっても一覧表示をやめない。
(setq quit-if-end-of-ichiran nil)       ; default nil

; 入力中の読み全体をリバースしない。
(setq reverse-widely         nil)       ; default nil

; 頻度学習をする。
(setq gakushu                t)         ; default t

; 候補一覧の番号を半角文字にする。
(setq index-hankaku	     t)         ; default nil

; 候補の番号との区切り文字。
(setq index-separator	     ?:)

; 記号入力モードで記号を入力したとき記号入力モードを終了する。
(setq quickly-escape-from-kigo-input t) ; default nil

; 単語登録/削除の直後に辞書の書き出し処理を行う
(setq auto-sync		     t)         ; default t
;; キーマップ

(global-unbind-key-function 'extend)
(global-unbind-key-function 'shrink)
(global-unbind-key-function 'forward)
(global-unbind-key-function 'backward)
(global-unbind-key-function 'previous)
(global-unbind-key-function 'next)
(global-unbind-key-function 'beginning-of-line)
(global-unbind-key-function 'end-of-line)
(global-unbind-key-function 'kill-to-end-of-line)
(global-unbind-key-function 'kouho-ichiran)

(global-set-key "\S-Right"  'extend)
(global-set-key "\S-Left"   'shrink)
(global-set-key "\Right"    'forward)
(global-set-key "\Down"     'forward)
(global-set-key "\Left"     'backward)
(global-set-key "\Up"       'previous)
(global-set-key "\S-Up"     'previous)
(global-set-key "\S-Down"   'next)
(global-set-key "\Space"    'henkan)
(global-set-key "\Escape"   'quit)
(global-set-key "\F5"       'convert-as-hex)


;; 入力モードの定義

(defmode zenkaku-katakana-mode " 全カナ " romkana-table '(katakana) t)
(defmode hankaku-katakana-mode " 半カナ " romkana-table '(katakana hankaku) t)
(defmode zenkaku-eisu-mode     " 全英数 " nil '(zenkaku) nil)
(defmode hankaku-eisu-mode     " 半英数 " nil nil nil)

(set-key 'empty-mode            "\Nfer"   'zenkaku-katakana-mode)
(set-key 'zenkaku-katakana-mode "\Nfer"   'hankaku-katakana-mode)
(set-key 'hankaku-katakana-mode "\Nfer"   'henkan-nyuuryoku-mode)

(set-key 'empty-mode            "\S-Nfer" 'zenkaku-eisu-mode)
(set-key 'zenkaku-katakana-mode "\S-Nfer" 'zenkaku-eisu-mode)
(set-key 'hankaku-katakana-mode "\S-Nfer" 'zenkaku-eisu-mode)

(set-key 'zenkaku-eisu-mode     "\S-Nfer" 'hankaku-eisu-mode)
(set-key 'hankaku-eisu-mode     "\S-Nfer" 'zenkaku-eisu-mode)

(set-key 'zenkaku-eisu-mode     "\Nfer"   'henkan-nyuuryoku-mode)
(set-key 'hankaku-eisu-mode     "\Nfer"   'henkan-nyuuryoku-mode)


;; モード表示文字列定義

(set-mode-display 'henkan-nyuuryoku-mode " 全かな ")
(set-mode-display 'empty-mode            " 全かな ")
(set-mode-display 'yomi-mode             " 全かな ")


;; 読みモード時

(let ((mode 'yomi-mode))
  (set-key mode "\Delete"       'delete-next)
  (set-key mode "\Backspace"    'delete-previous)
  (set-key mode "\F6"           'hiragana)
  (set-key mode "\F7"           'katakana)
  (set-key mode "\F8"           'hankaku)
  (set-key mode "\F9"           'romaji)
  (set-key mode "\Down"         'kakutei)
  (set-key mode "\Return"       'kakutei)
  (set-key mode "\Xfer"         'henkan)
  )


;; 単候補モード時

(let ((mode 'tankouho-mode))
  (set-key mode "\F6"           'hiragana)
  (set-key mode "\F7"           'katakana)
  (set-key mode "\F8"           'hankaku)
  (set-key mode "\F9"           'romaji)
  (set-key mode "\Return"       'kakutei)
  (set-key mode "\Xfer"         'henkan)
  (set-key mode "\S-Right"      '(shinshuku-mode extend))
  (set-key mode "\S-Left"       '(shinshuku-mode shrink))
)


;; 文字種モード時

(let ((mode 'mojishu-mode))
  (set-key mode "\F6"           'hiragana)
  (set-key mode "\F7"           'katakana)
  (set-key mode "\F8"           'hankaku)
  (set-key mode "\F9"           'romaji)
  (set-key mode "\Return"       'kakutei)
)


;; 一覧候補モード時

(let ((mode 'ichiran-mode))
  (set-key mode "\S-Xfer"       'backward)
  (set-key mode "\Backspace"    'backward)
  (set-key mode "\Xfer"         'forward)
  (set-key mode "\Down"         'kakutei)
  (set-key mode "\S-Right"      '(quit shinshuku-mode extend))
  (set-key mode "\S-Left"       '(quit shinshuku-mode shrink))
)


;; 記号入力モード時

(let ((mode 'kigou-mode))
  (set-key mode "\S-Xfer"       'backward)
  (set-key mode "\Backspace"    'backward)
  (set-key mode "\Xfer"         'forward)
  (set-key mode "\Down"         'kakutei)
)


;; 伸縮モード時

(let ((mode 'shinshuku-mode))
  (set-key mode "\F6"           '(henkan hiragana))
  (set-key mode "\F7"           '(henkan katakana))
  (set-key mode "\F8"           '(henkan hankaku))
  (set-key mode "\F9"           '(henkan romaji))
)

;; シンボルの定義

(defsymbol
  ?, "、" "，"
  ?. "。" "．")

(defsymbol
  ?[ "「" "［"
  ?] "」" "］")

(defsymbol  ?/ "・" "／" )

