Mercurial > emacs
annotate lisp/language/korea-util.el @ 37327:086b7dd058d9
*** empty log message ***
author | John Wiegley <johnw@newartisans.com> |
---|---|
date | Wed, 11 Apr 2001 21:53:10 +0000 |
parents | 60eb71a9f901 |
children | 67b464da13ec |
rev | line source |
---|---|
20442 | 1 ;;; korea-util.el --- utilities for Korean |
2 | |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
4 | |
5 ;; Keywords: mule, multilingual, Korean | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;;; Code: | |
25 | |
26 ;;;###autoload | |
25599
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
27 (defvar default-korean-keyboard |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
28 (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
29 "3" |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
30 "") |
20442 | 31 "*The kind of Korean keyboard for Korean input method. |
32 \"\" for 2, \"3\" for 3.") | |
33 | |
34 ;; functions useful for Korean text input | |
35 | |
36 (defun toggle-korean-input-method () | |
37 "Turn on or off a Korean text input method for the current buffer." | |
38 (interactive) | |
39 (if current-input-method | |
40 (inactivate-input-method) | |
41 (activate-input-method | |
42 (concat "korean-hangul" default-korean-keyboard)))) | |
43 | |
44 (defun quail-hangul-switch-symbol-ksc (&rest ignore) | |
45 "Swith to/from Korean symbol package." | |
46 (interactive "i") | |
47 (and current-input-method | |
48 (if (string-equal current-input-method "korean-symbol") | |
49 (activate-input-method (concat "korean-hangul" | |
50 default-korean-keyboard)) | |
51 (activate-input-method "korean-symbol")))) | |
52 | |
53 (defun quail-hangul-switch-hanja (&rest ignore) | |
54 "Swith to/from Korean hanja package." | |
55 (interactive "i") | |
56 (and current-input-method | |
57 (if (string-match "korean-hanja" current-input-method) | |
58 (activate-input-method (concat "korean-hangul" | |
59 default-korean-keyboard)) | |
60 (activate-input-method (concat "korean-hanja" | |
61 default-korean-keyboard))))) | |
62 | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
63 ;; The following three commands are set in isearch-mode-map. |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
64 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
65 (defun isearch-toggle-korean-input-method () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
66 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
67 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
68 (toggle-korean-input-method)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
69 (setq isearch-input-method-function input-method-function |
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
70 isearch-input-method-local-p t) |
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
71 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
72 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
73 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
74 (defun isearch-hangul-switch-symbol-ksc () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
75 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
76 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
77 (quail-hangul-switch-symbol-ksc)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
78 (setq isearch-input-method-function input-method-function |
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
79 isearch-input-method-local-p t) |
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
80 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
81 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
82 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
83 (defun isearch-hangul-switch-hanja () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
84 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
85 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
86 (quail-hangul-switch-hanja)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
87 (setq isearch-input-method-function input-method-function |
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
88 isearch-input-method-local-p t) |
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
89 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
90 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
91 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
92 ;; Information for setting and exiting Korean environment. |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
93 (defvar korean-key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
94 `((global [?\S- ] toggle-korean-input-method nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
95 (global [C-f9] quail-hangul-switch-symbol-ksc nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
96 (global [f9] quail-hangul-switch-hanja nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
97 (,isearch-mode-map [?\S- ] isearch-toggle-korean-input-method nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
98 (,isearch-mode-map [C-f9] isearch-hangul-switch-symbol-ksc nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
99 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil))) |
20442 | 100 |
101 ;;;###autoload | |
22987
708271862495
(setup-XXX-environment): Just call set-language-environment. If
Kenichi Handa <handa@m17n.org>
parents:
22617
diff
changeset
|
102 (defun setup-korean-environment-internal () |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
103 (let ((key-bindings korean-key-bindings)) |
20442 | 104 (while key-bindings |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
105 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
106 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
107 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
108 old-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
109 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
110 (progn |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
111 (setq old-def (global-key-binding key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
112 (global-set-key key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
113 (setq old-def (lookup-key (car this) key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
114 (define-key (car this) key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
115 (setcar (nthcdr 3 this) old-def)) |
20442 | 116 (setq key-bindings (cdr key-bindings))))) |
117 | |
118 (defun exit-korean-environment () | |
119 "Exit Korean language environment." | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
120 (let ((key-bindings korean-key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
121 (while key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
122 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
123 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
124 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
125 (old-def (nth 3 this))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
126 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
127 (if (eq (global-key-binding key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
128 (global-set-key key old-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
129 (if (eq (lookup-key (car this) key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
130 (define-key (car this) key old-def)))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
131 (setq key-bindings (cdr key-bindings))))) |
20442 | 132 |
133 ;; | |
134 (provide 'korea-util) | |
135 | |
136 ;;; korean-util.el ends here |