3 ;; Copyright (C) 1999, 2000 PFU LIMITED
5 ;; Author: KATAYAMA Yoshio <kate@pfu.co.jp>
7 ;; Maintainer: TOMURA Satoru <tomura@etl.go.jp>
9 ;; Keywords: mule, multilingual, input method
11 ;; Keywords: mule, multilingual, input method
13 ;; This file is part of EGG.
15 ;; EGG is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; EGG is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA.
40 (defvar its-zhuyin nil)
41 (make-variable-buffer-local 'its-zhuyin)
42 (put 'its-zhuyin 'permanent-local t)
44 (defvar its-select-alist nil)
45 (make-variable-buffer-local 'its-select-func-alist)
46 (put 'its-select-alist 'permanent-local t)
48 (defvar its-select-func-default-alist nil)
51 (defmacro its-set-select-func-alist (list)
52 `'(setq ,list (cons (cons lang func)
53 (delq (assq lang ,list) ,list)))))
56 (defun its-make-select-func (key1 key2 func file map &optional zhuyin)
57 (setq func (intern (concat "its-select-" (symbol-name func)))
58 file (intern (concat "its/" (symbol-name file)))
59 map (intern (concat "its-" (symbol-name map) "-map")))
61 `(defun ,func (&optional temporally mode-line-unchange)
63 (let ((inhibit-read-only t)
67 (its-select-mode-temporally func)
73 ((egg-get-bunsetsu-info (point))
74 (egg-exit-conversion)))
75 (setq its-current-select-func func
77 lang (its-get-language ,map))
79 (setq its-current-language lang)
80 ;; avoid overwriting when select temporally
81 (when (and (null its-previous-select-func)
82 (null (assq lang its-select-func-default-alist)))
83 ,(its-set-select-func-alist its-select-func-alist)
84 ,(its-set-select-func-alist its-select-func-default-alist)))
85 ,(if zhuyin `(setq its-zhuyin ,(eq zhuyin 'T)))
86 (if (null mode-line-unchange)
87 (its-set-mode-line-title)))))
88 `(,func ,(concat "\C-x\C-m" key1) ,(concat "\e" key2)))))
90 (defmacro its-do-list-make-select-func (list)
91 (let (funcs keydefs pair)
93 (setq pair (apply 'its-make-select-func (car list))
94 funcs (cons (car pair) funcs)
95 keydefs (cons (cdr pair) keydefs)
99 (defvar its-define-select-key-list ',keydefs))))
101 (defmacro its-add-select-funcs (list)
102 (let (funcs keydefs pair)
104 (setq pair (apply 'its-make-select-func (car list))
105 funcs (cons (car pair) funcs)
106 keydefs (cons (cdr pair) keydefs)
110 (setq its-define-select-key-list
111 (append ',keydefs its-define-select-key-list)))))
113 (defun its-define-select-keys (map &optional fence)
114 (let ((key-list its-define-select-key-list))
116 (define-key map (nth 1 (car key-list)) (car (car key-list)))
118 (define-key map (nth 2 (car key-list)) (car (car key-list))))
119 (setq key-list (cdr key-list)))))
121 (its-do-list-make-select-func
122 (("Q" "Q" upcase ascii up)
123 ("q" "q" downcase ascii down)
124 ("h" "\C-h" hiragana hira hira)
125 ("k" "\C-k" katakana kata kata)
126 ("x" "\C-x" hankaku-katakana hankata han-kata)
127 ("Z" "Z" zenkaku-upcase zenkaku zenkaku-up)
128 ("z" "z" zenkaku-downcase zenkaku zenkaku-down)
129 ("\C-e" "\C-e" erpin-cn erpin erpin-cn NIL)
130 ("\C-p" "\C-p" pinyin-cn pinyin pinyin-cn NIL)
131 ("\C-z" "\C-z" zhuyin-cn zhuyin zhuyin-cn T)
132 ("\C-q" "\C-q" qianma bixing qianma)
133 ("\C-w" "\C-w" wubi bixing wubi)
134 ("\C-u" "\C-u" quanjiao-upcase-cn quanjiao quanjiao-up-cn)
135 ("\C-d" "\C-d" quanjiao-downcase-cn quanjiao quanjiao-down-cn)
136 ("E" "E" erpin-tw erpin erpin-tw NIL)
137 ("P" "P" pinyin-tw pinyin pinyin-tw NIL)
138 ("C" "C" zhuyin-tw zhuyin zhuyin-tw T)
139 ("U" "U" quanjiao-upcase-tw quanjiao quanjiao-up-tw)
140 ("D" "D" quanjiao-downcase-tw quanjiao quanjiao-down-tw)
141 ("H" "H" hangul hangul hangul)
142 ("J" "J" jeonkak-upcase jeonkak jeonkak-up)
143 ("j" "j" jeonkak-downcase jeonkak jeonkak-down)))
145 (provide 'its-keydef)