aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1998-06-26 03:29:58 +0000
committerKenichi Handa1998-06-26 03:29:58 +0000
commitfd28674852d3d02c82e1f4dc9469b3a3233e6071 (patch)
tree6df5dca543d519638c96944ca02cc40014601669
parent54f7817141b0252d988849b107c2439847d0ed89 (diff)
downloademacs-fd28674852d3d02c82e1f4dc9469b3a3233e6071.tar.gz
emacs-fd28674852d3d02c82e1f4dc9469b3a3233e6071.zip
(isearch-toggle-korean-input-method,
isearch-hangul-switch-symbol-ksc, isearch-hangul-switch-hanja): New functions. (korean-key-bindings): Renamed from exit-korean-environment-data. Initialized apropriately. (setup-korean-environment): Setup key bindings according to korean-key-bindings. (exit-korean-environment): Revert key bindings only if the current key bindings is the same as what set by setup-korean-environment.
-rw-r--r--lisp/language/korea-util.el67
1 files changed, 52 insertions, 15 deletions
diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el
index c2a0310a3c7..c1787a15a3b 100644
--- a/lisp/language/korea-util.el
+++ b/lisp/language/korea-util.el
@@ -57,8 +57,34 @@
57 (activate-input-method (concat "korean-hanja" 57 (activate-input-method (concat "korean-hanja"
58 default-korean-keyboard))))) 58 default-korean-keyboard)))))
59 59
60;; Information for exiting Korean environment. 60;; The following three commands are set in isearch-mode-map.
61(defvar exit-korean-environment-data nil) 61
62(defun isearch-toggle-korean-input-method ()
63 (interactive)
64 (let ((overriding-terminal-local-map nil))
65 (toggle-korean-input-method))
66 (isearch-update))
67
68(defun isearch-hangul-switch-symbol-ksc ()
69 (interactive)
70 (let ((overriding-terminal-local-map nil))
71 (quail-hangul-switch-symbol-ksc))
72 (isearch-update))
73
74(defun isearch-hangul-switch-hanja ()
75 (interactive)
76 (let ((overriding-terminal-local-map nil))
77 (quail-hangul-switch-hanja))
78 (isearch-update))
79
80;; Information for setting and exiting Korean environment.
81(defvar korean-key-bindings
82 `((global [?\S- ] toggle-korean-input-method nil)
83 (global [C-f9] quail-hangul-switch-symbol-ksc nil)
84 (global [f9] quail-hangul-switch-hanja nil)
85 (,isearch-mode-map [?\S- ] isearch-toggle-korean-input-method nil)
86 (,isearch-mode-map [C-f9] isearch-hangul-switch-symbol-ksc nil)
87 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil)))
62 88
63;;;###autoload 89;;;###autoload
64(defun setup-korean-environment () 90(defun setup-korean-environment ()
@@ -69,24 +95,35 @@
69 95
70 (setq default-input-method "korean-hangul") 96 (setq default-input-method "korean-hangul")
71 97
72 (let ((key-bindings '(([?\S- ] . toggle-korean-input-method) 98 (let ((key-bindings korean-key-bindings))
73 ([C-f9] . quail-hangul-switch-symbol-ksc)
74 ([f9] . quail-hangul-switch-hanja))))
75 (while key-bindings 99 (while key-bindings
76 (let ((prev-binding (global-key-binding (car (car key-bindings))))) 100 (let* ((this (car key-bindings))
77 (setq exit-korean-environment-data 101 (key (nth 1 this))
78 (cons (cons (car (car key-bindings)) prev-binding) 102 (new-def (nth 2 this))
79 exit-korean-environment-data))) 103 old-def)
80 (global-set-key (car (car key-bindings)) (cdr (car key-bindings))) 104 (if (eq (car this) 'global)
105 (progn
106 (setq old-def (global-key-binding key))
107 (global-set-key key new-def))
108 (setq old-def (lookup-key (car this) key))
109 (define-key (car this) key new-def))
110 (setcar (nthcdr 3 this) old-def))
81 (setq key-bindings (cdr key-bindings))))) 111 (setq key-bindings (cdr key-bindings)))))
82 112
83(defun exit-korean-environment () 113(defun exit-korean-environment ()
84 "Exit Korean language environment." 114 "Exit Korean language environment."
85 (while exit-korean-environment-data 115 (let ((key-bindings korean-key-bindings))
86 (global-set-key (car (car exit-korean-environment-data)) 116 (while key-bindings
87 (cdr (car exit-korean-environment-data))) 117 (let* ((this (car key-bindings))
88 (setq exit-korean-environment-data 118 (key (nth 1 this))
89 (cdr exit-korean-environment-data)))) 119 (new-def (nth 2 this))
120 (old-def (nth 3 this)))
121 (if (eq (car this) 'global)
122 (if (eq (global-key-binding key) new-def)
123 (global-set-key key old-def))
124 (if (eq (lookup-key (car this) key) new-def)
125 (define-key (car this) key old-def))))
126 (setq key-bindings (cdr key-bindings)))))
90 127
91;; 128;;
92(provide 'korea-util) 129(provide 'korea-util)