Mercurial > emacs
annotate lisp/language/korea-util.el @ 45483:81cb13e7ce4f
*** empty log message ***
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Thu, 23 May 2002 10:20:12 +0000 |
parents | 67b464da13ec |
children | 695cf19ef79e d7ddb3e565de |
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 | |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28906
diff
changeset
|
24 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28906
diff
changeset
|
25 |
20442 | 26 ;;; Code: |
27 | |
28 ;;;###autoload | |
25599
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
29 (defvar default-korean-keyboard |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
30 (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
31 "3" |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
32 "") |
20442 | 33 "*The kind of Korean keyboard for Korean input method. |
34 \"\" for 2, \"3\" for 3.") | |
35 | |
36 ;; functions useful for Korean text input | |
37 | |
38 (defun toggle-korean-input-method () | |
39 "Turn on or off a Korean text input method for the current buffer." | |
40 (interactive) | |
41 (if current-input-method | |
42 (inactivate-input-method) | |
43 (activate-input-method | |
44 (concat "korean-hangul" default-korean-keyboard)))) | |
45 | |
46 (defun quail-hangul-switch-symbol-ksc (&rest ignore) | |
47 "Swith to/from Korean symbol package." | |
48 (interactive "i") | |
49 (and current-input-method | |
50 (if (string-equal current-input-method "korean-symbol") | |
51 (activate-input-method (concat "korean-hangul" | |
52 default-korean-keyboard)) | |
53 (activate-input-method "korean-symbol")))) | |
54 | |
55 (defun quail-hangul-switch-hanja (&rest ignore) | |
56 "Swith to/from Korean hanja package." | |
57 (interactive "i") | |
58 (and current-input-method | |
59 (if (string-match "korean-hanja" current-input-method) | |
60 (activate-input-method (concat "korean-hangul" | |
61 default-korean-keyboard)) | |
62 (activate-input-method (concat "korean-hanja" | |
63 default-korean-keyboard))))) | |
64 | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
65 ;; 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
|
66 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
67 (defun isearch-toggle-korean-input-method () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
68 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
69 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
70 (toggle-korean-input-method)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
71 (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
|
72 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
|
73 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
74 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
75 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
76 (defun isearch-hangul-switch-symbol-ksc () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
77 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
78 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
79 (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
|
80 (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
|
81 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
|
82 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
83 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
84 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
85 (defun isearch-hangul-switch-hanja () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
86 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
87 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
88 (quail-hangul-switch-hanja)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
89 (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
|
90 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
|
91 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
92 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
93 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
94 ;; Information for setting and exiting Korean environment. |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
95 (defvar korean-key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
96 `((global [?\S- ] toggle-korean-input-method nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
97 (global [C-f9] quail-hangul-switch-symbol-ksc nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
98 (global [f9] quail-hangul-switch-hanja nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
99 (,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
|
100 (,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
|
101 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil))) |
20442 | 102 |
103 ;;;###autoload | |
22987
708271862495
(setup-XXX-environment): Just call set-language-environment. If
Kenichi Handa <handa@m17n.org>
parents:
22617
diff
changeset
|
104 (defun setup-korean-environment-internal () |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
105 (let ((key-bindings korean-key-bindings)) |
20442 | 106 (while key-bindings |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
107 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
108 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
109 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
110 old-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
111 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
112 (progn |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
113 (setq old-def (global-key-binding key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
114 (global-set-key key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
115 (setq old-def (lookup-key (car this) key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
116 (define-key (car this) key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
117 (setcar (nthcdr 3 this) old-def)) |
20442 | 118 (setq key-bindings (cdr key-bindings))))) |
119 | |
120 (defun exit-korean-environment () | |
121 "Exit Korean language environment." | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
122 (let ((key-bindings korean-key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
123 (while key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
124 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
125 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
126 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
127 (old-def (nth 3 this))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
128 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
129 (if (eq (global-key-binding key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
130 (global-set-key key old-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
131 (if (eq (lookup-key (car this) key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
132 (define-key (car this) key old-def)))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
133 (setq key-bindings (cdr key-bindings))))) |
20442 | 134 |
135 ;; | |
136 (provide 'korea-util) | |
137 | |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28906
diff
changeset
|
138 ;;; korea-util.el ends here |