2009年5月26日火曜日

emacs22 default日本語環境

OpenBSDにskkを入れるほど根性無いし、
emacs22だと set-input-method "japanese" で kcc 使って日本語入力出来ちゃうので
kccをskkっぽくして、しのぐことにする...中途半端だけどw


(set-language-environment "Japanese")
(set-terminal-coding-system 'utf-8-unix)
(set-keyboard-coding-system 'utf-8-unix)
(set-buffer-file-coding-system 'utf-8-unix)

;; change quail + kkc keybind like skk
(global-set-key "\C-xj" `toggle-input-method)

(defun my-kcc-mode-act-hook ()
;; nn を ん に変換する。
(setq quail-japanese-use-double-n t)

;; 変換中のCtrl-gで変換をキャンセル
(define-key kkc-keymap "\C-g" 'kkc-cancel)

(defun my-kanji-mode ()
(interactive)
(set-input-method "japanese")
)
(defun my-ascii-mode ()
(interactive)
(set-input-method "japanese-ascii")
)
(defun my-katakana-mode ()
(interactive)
(set-input-method "japanese-katakana")
)
(local-set-key "\C-l" 'my-ascii-mode)
(local-set-key "\C-q" 'my-katakana-mode)
(local-set-key "\C-j" 'my-kanji-mode)
)

(defun my-kcc-mode-inact-hook ()
(local-unset-key "\C-l")
(local-unset-key "\C-q")
(local-unset-key "\C-j")
)

(add-hook 'input-method-activate-hook 'my-kcc-mode-act-hook)
(add-hook 'input-method-inactivate-hook 'my-kcc-mode-inact-hook)

0 件のコメント: