Mercurial > emacs
annotate lisp/language/korea-util.el @ 82385:7597b0681f62
whitespace
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 15 Aug 2007 03:09:04 +0000 |
parents | 0938de05f510 |
children | b5d3fc1c4afe f55f9811f5d7 |
rev | line source |
---|---|
20442 | 1 ;;; korea-util.el --- utilities for Korean |
2 | |
75347 | 3 ;; Copyright (C) 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
74544 | 4 ;; Free Software Foundation, Inc. |
75347 | 5 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
62396 | 6 ;; National Institute of Advanced Industrial Science and Technology (AIST) |
7 ;; Registration Number H14PRO021 | |
20442 | 8 |
9 ;; Keywords: mule, multilingual, Korean | |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
78309
0938de05f510
Restore comma mistakenly removed in last change.
Glenn Morris <rgm@gnu.org>
parents:
78300
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
20442 | 16 ;; any later version. |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
20442 | 27 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28906
diff
changeset
|
28 ;;; Commentary: |
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28906
diff
changeset
|
29 |
20442 | 30 ;;; Code: |
31 | |
32 ;;;###autoload | |
25599
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
33 (defvar default-korean-keyboard |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
34 (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
35 "3" |
34282f1ae111
(default-korean-keyboard): Initialize it
Kenichi Handa <handa@m17n.org>
parents:
24717
diff
changeset
|
36 "") |
20442 | 37 "*The kind of Korean keyboard for Korean input method. |
38 \"\" for 2, \"3\" for 3.") | |
39 | |
40 ;; functions useful for Korean text input | |
41 | |
42 (defun toggle-korean-input-method () | |
43 "Turn on or off a Korean text input method for the current buffer." | |
44 (interactive) | |
45 (if current-input-method | |
46 (inactivate-input-method) | |
47 (activate-input-method | |
48 (concat "korean-hangul" default-korean-keyboard)))) | |
49 | |
50 (defun quail-hangul-switch-symbol-ksc (&rest ignore) | |
51 "Swith to/from Korean symbol package." | |
52 (interactive "i") | |
53 (and current-input-method | |
54 (if (string-equal current-input-method "korean-symbol") | |
55 (activate-input-method (concat "korean-hangul" | |
56 default-korean-keyboard)) | |
57 (activate-input-method "korean-symbol")))) | |
58 | |
59 (defun quail-hangul-switch-hanja (&rest ignore) | |
60 "Swith to/from Korean hanja package." | |
61 (interactive "i") | |
62 (and current-input-method | |
63 (if (string-match "korean-hanja" current-input-method) | |
64 (activate-input-method (concat "korean-hangul" | |
65 default-korean-keyboard)) | |
66 (activate-input-method (concat "korean-hanja" | |
67 default-korean-keyboard))))) | |
68 | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
69 ;; 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
|
70 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
71 (defun isearch-toggle-korean-input-method () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
72 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
73 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
74 (toggle-korean-input-method)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
75 (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
|
76 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
|
77 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
78 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
79 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
80 (defun isearch-hangul-switch-symbol-ksc () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
81 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
82 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
83 (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
|
84 (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
|
85 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
|
86 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
87 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
88 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
89 (defun isearch-hangul-switch-hanja () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
90 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
91 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
92 (quail-hangul-switch-hanja)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
93 (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
|
94 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
|
95 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
96 (isearch-update)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
97 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
98 ;; Information for setting and exiting Korean environment. |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
99 (defvar korean-key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
100 `((global [?\S- ] toggle-korean-input-method nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
101 (global [C-f9] quail-hangul-switch-symbol-ksc nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
102 (global [f9] quail-hangul-switch-hanja nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
103 (,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
|
104 (,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
|
105 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil))) |
20442 | 106 |
107 ;;;###autoload | |
22987
708271862495
(setup-XXX-environment): Just call set-language-environment. If
Kenichi Handa <handa@m17n.org>
parents:
22617
diff
changeset
|
108 (defun setup-korean-environment-internal () |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
109 (let ((key-bindings korean-key-bindings)) |
20442 | 110 (while key-bindings |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
111 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
112 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
113 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
114 old-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
115 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
116 (progn |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
117 (setq old-def (global-key-binding key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
118 (global-set-key key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
119 (setq old-def (lookup-key (car this) key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
120 (define-key (car this) key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
121 (setcar (nthcdr 3 this) old-def)) |
20442 | 122 (setq key-bindings (cdr key-bindings))))) |
123 | |
124 (defun exit-korean-environment () | |
125 "Exit Korean language environment." | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
126 (let ((key-bindings korean-key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
127 (while key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
128 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
129 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
130 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
131 (old-def (nth 3 this))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
132 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
133 (if (eq (global-key-binding key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
134 (global-set-key key old-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
135 (if (eq (lookup-key (car this) key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
136 (define-key (car this) key old-def)))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
137 (setq key-bindings (cdr key-bindings))))) |
20442 | 138 |
139 ;; | |
140 (provide 'korea-util) | |
141 | |
52401 | 142 ;;; arch-tag: b17d0981-05da-4577-99f8-1db87fff8b44 |
38414
67b464da13ec
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28906
diff
changeset
|
143 ;;; korea-util.el ends here |