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