;; Copyright 1992 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 vje-β does.

;;  $Id: vje.canna,v 2.11 1996/10/25 05:23:04 kon Exp $

;;; ローマ字かな変換の設定
(setq romkana-table "vje.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 select-direct          t)         ; default t

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

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

; 一覧の最後までいったら、また先頭の候補を表示する。
(setq quit-if-end-of-ichiran nil)       ; default nil

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

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

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

; 候補が全体の何番目かを表示しない。
(setq kouho-count            nil)       ; 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     'quoted-insert)
(global-unbind-key-function     'extend)
(global-unbind-key-function     'shrink)
(global-unbind-key-function     'previous)
(global-unbind-key-function     'next)
(global-unbind-key-function     'forward)
(global-unbind-key-function     'backward)
(global-unbind-key-function     'henkan)
(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     'quit)

(global-set-key "\Backspace"    'delete-previous)
(global-set-key "\C-g"          'delete-next)
(global-set-key "\Delete"       'delete-next)
(global-set-key "\C-s"          'backward)
(global-set-key "\Left"         'backward)
(global-set-key "\C-d"          'forward)
(global-set-key "\Right"        'forward)
(global-set-key "\C-a"          'beginning-of-line)
(global-set-key "\Rollup"       'beginning-of-line)
(global-set-key "\C-f"          'end-of-line)
(global-set-key "\Rolldown"     'end-of-line)
(global-set-key "\C-y"          'quit)
(global-set-key "\C-w"          'extend)
(global-set-key "\C-q"          'shrink)
(global-set-key "\Down"         'next)
(global-set-key "\C-x"          'next)
(global-set-key "\Up"           'previous)
(global-set-key "\C-e"          'previous)
(global-set-key "\Xfer"         'henkan)

(global-set-key "\S-Nfer"       'base-hiragana-katakana-toggle)
(global-set-key "\C-Nfer"       'base-kana-eisu-toggle)


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

(set-mode-display 'henkan-nyuuryoku-mode " かな全 ")
(set-mode-display 'empty-mode            " かな全 ")
(set-mode-display 'yomi-mode             " かな全 ")
(set-mode-display 'zen-kata-henkan-mode  " カナ全 ")
(set-mode-display 'han-kata-henkan-mode  " カナ半 ")
(set-mode-display 'zen-alpha-henkan-mode " 英数全 ")
(set-mode-display 'han-alpha-henkan-mode " 英数半 ")


;; 読みモード時

(let ((mode 'yomi-mode))
  (set-key mode "\C-j"          'hiragana)
  (set-key mode "\F6"           'hiragana)
  (set-key mode "\C-k"          'katakana)
  (set-key mode "\F7"           'katakana)
  (set-key mode "\C-l"          'romaji)
  (set-key mode "\F8"           'romaji)
  (set-key mode "\C-o"          'hankaku)
  (set-key mode "\F9"           'hankaku)
  (set-key mode "\F5"           'convert-as-hex)
  (set-key mode "\Nfer"         'kakutei)
  (set-key mode "\C-@"          'kakutei)
  (set-key mode "\C-c"          'henkan)
  (set-key mode "\Up"           'henkan)
  (set-key mode "\Down"         '(henkan kouho-ichiran backward))
  (set-key mode "\C-x"          '(henkan kouho-ichiran backward))
)


;; 文字種モード時

(let ((mode 'mojishu-mode))
  (set-key mode "\C-j"          'hiragana)
  (set-key mode "\F6"           'hiragana)
  (set-key mode "\C-k"          'katakana)
  (set-key mode "\F7"           'katakana)
  (set-key mode "\C-l"          'romaji)
  (set-key mode "\F8"           'romaji)
  (set-key mode "\C-o"          'hankaku)
  (set-key mode "\F9"           'hankaku)
  (set-key mode "\S-Right"      'extend)
  (set-key mode "\S-Left"       'shrink)
  (set-key mode "\Nfer"         'kakutei)
  (set-key mode "\C-@"          'kakutei)
)


;; 単候補モード時

(let ((mode 'tankouho-mode))
  (set-key mode "\Space"        'forward)
  (set-key mode "\C-j"          'hiragana)
  (set-key mode "\F6"           'hiragana)
  (set-key mode "\C-k"          'katakana)
  (set-key mode "\F7"           'katakana)
  (set-key mode "\C-l"          'romaji)
  (set-key mode "\F8"           'romaji)
  (set-key mode "\C-o"          'hankaku)
  (set-key mode "\F9"           'hankaku)
  (set-key mode "\C-c"          'henkan)
  (set-key mode "\C-z"          'previous)
  (set-key mode "\S-Xfer"       'previous)
  (set-key mode "\Down"         'kouho-ichiran)
  (set-key mode "\C-x"          'kouho-ichiran)
  (set-key mode "\Nfer"         'kakutei)
  (set-key mode "\C-@"          'kakutei)
  (set-key mode "\S-Right"      'extend)
  (set-key mode "\S-Left"       'shrink)
)


;; 一覧候補モード時

(let ((mode 'ichiran-mode))
  (set-key mode "\Xfer"         'forward)
  (set-key mode "\C-c"          'forward)
  (set-key mode "\S-Xfer"       'backward)
  (set-key mode "\C-z"          'backward)
  (set-key mode "\Space"        'kakutei)
  (set-key mode "\Nfer"         'kakutei)
  (set-key mode "\C-@"          'kakutei)
  (set-key mode "\S-Right"      '(quit extend))
  (set-key mode "\C-w"          '(quit extend))
  (set-key mode "\S-Left"       '(quit shrink))
  (set-key mode "\C-q"          '(quit shrink))
)


;; 記号入力モード時

(let ((mode 'kigou-mode))
  (set-key mode "\Xfer"         'forward)
  (set-key mode "\C-c"          'forward)
  (set-key mode "\S-Xfer"       'backward)
  (set-key mode "\C-z"          'backward)
  (set-key mode "\Space"        'kakutei)
  (set-key mode "\Nfer"         'kakutei)
  (set-key mode "\C-@"          'kakutei)
)


;; 辞書マウントアンマウント時

(let ((mode 'on-off-mode))
  (set-key mode "\Xfer"         'forward)
  (set-key mode "\Space"        'henkan)
  (set-key mode "\Nfer"         'kakutei)
  (set-key mode "\C-@"          'kakutei)
)


;; シンボルの定義

(defsymbol  ?, "、" "," )
(defsymbol  ?. "。" "." )
(defsymbol  ?/ "・" "／") 
(defsymbol  ?- "ー" "−")
(defsymbol  ?[ "「" "[" )
(defsymbol  ?] "」" "]" )
