Posted at

SKK で舊字舊かなと新字新かなを切り換へられる設定を書いた.

More than 5 years have passed since last update.

SKK で舊字舊かなと新字新かなを切り換へられる設定を書いた.


以下を home directory に置く:

ldic_kyuji.dic --- 北極三號改の辭書 npiiii.l.euc をこの名にしておく.

udic_kyuji.dic --- 舊字舊かなの user 辭書.

udic_kyuji.dic.BAK --- 舊字舊かなの user 辭書の backup.

ldic_shinji.dic --- SKK-JISYO.L をこの名にしておく.

udic_shinji.dic --- 新字新かなの user 辭書.

udic_shinji.dic.BAK --- 新字新かなの user 辭書の backup.


以下を init.el に記述する:


init.el

(setq skk-large-jisyo "~/ldic_kyuji.dic")

(setq skk-jisyo "~/udic_kyuji.dic")
(setq skk-backup-jisyo "~/udic_kyuji.dic.BAK")

(defun kyu-shin (x) (replace-regexp-in-string "kyu" "shin" x))
(defun shin-kyu (x) (replace-regexp-in-string "shin" "kyu" x))

(defun shinji-to-kyuji nil
(interactive)
(progn
(skk-mode -1)
(skk-save-jisyo)
(setq lub (list skk-large-jisyo skk-jisyo skk-backup-jisyo))
(setq newlub (mapcar (function shin-kyu) lub))
(setq skk-large-jisyo (nth 0 newlub))
(setq skk-jisyo (nth 1 newlub))
(setq skk-backup-jisyo (nth 2 newlub))
(skk-mode 1)))

(defun kyuji-to-shinji nil
(interactive)
(progn
(skk-mode -1)
(skk-save-jisyo)
(setq lub (list skk-large-jisyo skk-jisyo skk-backup-jisyo))
(setq newlub (mapcar (function kyu-shin) lub))
(setq skk-large-jisyo (nth 0 newlub))
(setq skk-jisyo (nth 1 newlub))
(setq skk-backup-jisyo (nth 2 newlub))
(skk-mode 1)))

(defun toggle-jitai nil
(interactive)
(cond
((and
(equal skk-large-jisyo "~/ldic_shinji.dic")
(equal skk-jisyo "~/udic_shinji.dic")
(equal skk-backup-jisyo "~/udic_shinji.dic.BAK"))
(shinji-to-kyuji))

((and
(equal skk-large-jisyo "~/ldic_kyuji.dic")
(equal skk-jisyo "~/udic_kyuji.dic")
(equal skk-backup-jisyo "~/udic_kyuji.dic.BAK"))
(kyuji-to-shinji))
((t nil))))

(defun show-lub nil
(interactive)
(setq lub (list skk-large-jisyo skk-jisyo skk-backup-jisyo))
(princ lub))

(global-set-key [f8] 'toggle-jitai)
(global-set-key (kbd "C-<f8>") 'show-lub)



結果

Emacs および DDSKK の起動時は舊字舊かなで入力できる.

F8 で舊字舊かなと新字新かなを toggle できる.

C-F8 で現在の状態を表示できる.