(defvar its-zhuyin nil)
(make-variable-buffer-local 'its-zhuyin)
-(defun its-make-select-func (key name file map &optional lang zhuyin)
+(defun its-make-select-func (key1 key2 name file map &optional lang zhuyin)
(setq name (intern (concat "its-select-" (symbol-name name)))
file (intern (concat "its/" (symbol-name file)))
map (intern (concat "its-" (symbol-name map) "-map"))
,(if zhuyin `(setq its-zhuyin ,(eq zhuyin 'T)))
(if (null mode-line-unchange)
(egg-set-mode-line-title)))
- `(define-key map ,(concat "\C-x\C-m" key) ',name)))
+ `(define-key map
+ (if fence
+ ,(concat "\e" (vector key2))
+ ,(concat "\C-x\C-m" (vector key1)))
+ ',name)))
(defmacro its-do-list-make-select-func (list)
(eval-when (eval compile)
(setq list (cdr list)))
`(progn
,@funcs
- (defun its-define-select-keys (map)
+ (defun its-define-select-keys (map &optional fence)
,@keydefs)))))
(its-do-list-make-select-func
- (("Q" upcase ascii up)
- ("q" downcase ascii down)
- ("h" hiragana hira hira Japanese)
- ("K" katakana kata kata Japanese)
- ("x" hankaku-katakana hankata han-kata Japanese)
- ("Z" zenkaku-upcase zenkaku zenkaku-up Japanese)
- ("z" zenkaku-downcase zenkaku zenkaku-down Japanese)
- ("\C-e" erpin-cn erpin erpin-cn Chinese-GB NIL)
- ("\C-p" pinyin-cn pinyin pinyin-cn Chinese-GB NIL)
- ("\C-z" zhuyin-cn zhuyin zhuyin-cn Chinese-GB T)
- ("\C-u" quanjiao-upcase-cn quanjiao quanjiao-up-cn Chinese-GB)
- ("\C-d" quanjiao-downcase-cn quanjiao quanjiao-down-cn Chinese-GB)
- ("E" erpin-tw erpin erpin-tw Chinese-CNS NIL)
- ("P" pinyin-tw pinyin pinyin-tw Chinese-CNS NIL)
- ("Z" zhuyin-tw zhuyin zhuyin-tw Chinese-CNS T)
- ("U" quanjiao-upcase-tw quanjiao quanjiao-up-tw Chinese-CNS)
- ("C" quanjiao-downcase-tw quanjiao quanjiao-down-tw Chinese-CNS)
- ("H" hangul hangul hangul Korean)
- ("J" jeonkak-upcase jeonkak jeonkak-up Korean)
- ("j" jeonkak-downcase jeonkak jeonkak-down Korean)))
+ ((?Q ?Q upcase ascii up)
+ (?q ?q downcase ascii down)
+ (?h ?\C-h hiragana hira hira Japanese)
+ (?k ?\C-k katakana kata kata Japanese)
+ (?x ?\C-x hankaku-katakana hankata han-kata Japanese)
+ (?Z ?Z zenkaku-upcase zenkaku zenkaku-up Japanese)
+ (?z ?z zenkaku-downcase zenkaku zenkaku-down Japanese)
+ (?\C-e ?\C-e erpin-cn erpin erpin-cn Chinese-GB NIL)
+ (?\C-p ?\C-p pinyin-cn pinyin pinyin-cn Chinese-GB NIL)
+ (?\C-z ?\C-z zhuyin-cn zhuyin zhuyin-cn Chinese-GB T)
+ (?\C-u ?\C-u quanjiao-upcase-cn quanjiao quanjiao-up-cn Chinese-GB)
+ (?\C-d ?\C-d quanjiao-downcase-cn quanjiao quanjiao-down-cn Chinese-GB)
+ (?E ?E erpin-tw erpin erpin-tw Chinese-CNS NIL)
+ (?P ?P pinyin-tw pinyin pinyin-tw Chinese-CNS NIL)
+ (?Z ?Z zhuyin-tw zhuyin zhuyin-tw Chinese-CNS T)
+ (?U ?U quanjiao-upcase-tw quanjiao quanjiao-up-tw Chinese-CNS)
+ (?C ?C quanjiao-downcase-tw quanjiao quanjiao-down-tw Chinese-CNS)
+ (?H ?H hangul hangul hangul Korean)
+ (?J ?J jeonkak-upcase jeonkak jeonkak-up Korean)
+ (?j ?j jeonkak-downcase jeonkak jeonkak-down Korean)))
(provide 'its-keydef)
;;
;;
+(require 'its-keydef)
+
(defvar its-mode-map
(let ((map (make-sparse-keymap))
(i 33))
(define-key map " " 'its-kick-convert-region)
(define-key map "\177" 'its-delete-backward-SYL)
;;
- (define-key map "\C-p" 'its-previous-map)
- (define-key map "\C-n" 'its-next-map)
-; (define-key map "\M-h" 'its-hiragana) ; hiragana-region for input-buffer
-; (define-key map "\M-k" 'its-katakana)
-; (define-key map "\M-<" 'its-hankaku)
-; (define-key map "\M->" 'its-zenkaku)
-; (define-key map "\M-\C-h" 'its-select-hiragana)
-; (define-key map "\M-\C-k" 'its-select-katakana)
-;;; (define-key map "\M-q" 'its-select-downcase) ;
-; (define-key map "\M-Q" 'its-select-upcase)
-; (define-key map "\M-z" 'its-select-zenkaku-downcase)
-; (define-key map "\M-Z" 'its-select-zenkaku-upcase)
+ (define-key map "\M-p" 'its-previous-map)
+ (define-key map "\M-n" 'its-next-map)
+ (define-key map "\M-h" 'its-hiragana) ; hiragana-region for input-buffer
+ (define-key map "\M-k" 'its-katakana)
+ (define-key map "\M-<" 'its-hankaku)
+ (define-key map "\M->" 'its-zenkaku)
+ (its-define-select-keys map t)
map)
"Keymap for ITS mode.")
(defconst its-setup-fence-before-insert-SYL nil)
(defun its-put-cursor (cursor)
- (let ((p (point)))
+ (let ((p (point))
+ (map (copy-keymap its-mode-map)))
+ (its-define-select-keys map)
(insert "!")
- (add-text-properties p (point) (list 'local-map its-mode-map
+ (add-text-properties p (point) (list 'local-map map
'invisible t
'intangible 'its-part-2
'its-cursor cursor))
(delete-region start end)
(insert its-translation-result)))
\f
-(require 'its-keydef)
-
(provide 'its)
;;; its.el ends here.