X-Git-Url: http://git.chise.org/gitweb/?p=elisp%2Fegg.git;a=blobdiff_plain;f=its-keydef.el;fp=its-keydef.el;h=93724910774214972440267eab641e9a2f36a49a;hp=5e3a8353d22964e72d2d88297762741a19bf08df;hb=28fb101186f07642d2a7e203dca11c9256b9868a;hpb=ac64fa49e9ac4ca2a54ae4a42c4aed2a50803565 diff --git a/its-keydef.el b/its-keydef.el index 5e3a835..9372491 100644 --- a/its-keydef.el +++ b/its-keydef.el @@ -5,7 +5,7 @@ (make-variable-buffer-local 'its-zhuyin) (put 'its-zhuyin 'permanent-local t) -(eval-and-compile +(eval-when (eval compile) (defun its-make-select-func (key1 key2 func file map &optional zhuyin) (setq func (intern (concat "its-select-" (symbol-name func))) file (intern (concat "its/" (symbol-name file))) @@ -23,45 +23,31 @@ (its-put-cursor t)) ((egg-get-bunsetsu-info (point)) (egg-exit-conversion))) - (setq its-current-select-func ',func - its-current-map ',map) - (if (its-get-language ,map) - (setq its-current-language (its-get-language ,map))) + (setq its-current-select-func ',func) + (setq its-current-map ,map) + (if (its-get-language its-current-map) + (setq its-current-language (its-get-language its-current-map))) ,(if zhuyin `(setq its-zhuyin ,(eq zhuyin 'T))) (if (null mode-line-unchange) (its-set-mode-line-title))))) - `(,func ,(concat "\C-x\C-m" key1) ,(concat "\e" key2))))) + `(define-key map + (if fence + ,(concat "\e" key2) + ,(concat "\C-x\C-m" key1)) + ',func)))) (defmacro its-do-list-make-select-func (list) - (let (funcs keydefs pair) - (while list - (setq pair (apply 'its-make-select-func (car list)) - funcs (cons (car pair) funcs) - keydefs (cons (cdr pair) keydefs) - list (cdr list))) - `(progn - ,@funcs - (defvar its-define-select-key-list ',keydefs)))) - -(defmacro its-add-select-funcs (list) - (let (funcs keydefs pair) - (while list - (setq pair (apply 'its-make-select-func (car list)) - funcs (cons (car pair) funcs) - keydefs (cons (cdr pair) keydefs) - list (cdr list))) - `(progn - ,@funcs - (setq its-define-select-key-list - (append ',keydefs its-define-select-key-list))))) - -(defun its-define-select-keys (map &optional fence) - (let ((key-list its-define-select-key-list)) - (while key-list - (define-key map (nth 1 (car key-list)) (car (car key-list))) - (if fence - (define-key map (nth 2 (car key-list)) (car (car key-list)))) - (setq key-list (cdr key-list))))) + (eval-when (eval compile) + (let (funcs keydefs pair) + (while list + (setq pair (apply 'its-make-select-func (car list))) + (setq funcs (cons (car pair) funcs) + keydefs (cons (cdr pair) keydefs)) + (setq list (cdr list))) + `(progn + ,@funcs + (defun its-define-select-keys (map &optional fence) + ,@keydefs))))) (its-do-list-make-select-func (("Q" "Q" upcase ascii up)