Mercurial > emacs
annotate lisp/language/korea-util.el @ 24760:079175ba0db7
(diary-mail-entries): Use fancy-diary-buffer.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 22 May 1999 19:53:39 +0000 |
parents | ea66a10b8c12 |
children | 34282f1ae111 |
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 | |
27 (defvar default-korean-keyboard "" | |
28 "*The kind of Korean keyboard for Korean input method. | |
29 \"\" for 2, \"3\" for 3.") | |
30 | |
31 ;; functions useful for Korean text input | |
32 | |
33 (defun toggle-korean-input-method () | |
34 "Turn on or off a Korean text input method for the current buffer." | |
35 (interactive) | |
36 (if current-input-method | |
37 (inactivate-input-method) | |
38 (activate-input-method | |
39 (concat "korean-hangul" default-korean-keyboard)))) | |
40 | |
41 (defun quail-hangul-switch-symbol-ksc (&rest ignore) | |
42 "Swith to/from Korean symbol package." | |
43 (interactive "i") | |
44 (and current-input-method | |
45 (if (string-equal current-input-method "korean-symbol") | |
46 (activate-input-method (concat "korean-hangul" | |
47 default-korean-keyboard)) | |
48 (activate-input-method "korean-symbol")))) | |
49 | |
50 (defun quail-hangul-switch-hanja (&rest ignore) | |
51 "Swith to/from Korean hanja package." | |
52 (interactive "i") | |
53 (and current-input-method | |
54 (if (string-match "korean-hanja" current-input-method) | |
55 (activate-input-method (concat "korean-hangul" | |
56 default-korean-keyboard)) | |
57 (activate-input-method (concat "korean-hanja" | |
58 default-korean-keyboard))))) | |
59 | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
60 ;; 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
|
61 |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
62 (defun isearch-toggle-korean-input-method () |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
63 (interactive) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
64 (let ((overriding-terminal-local-map nil)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
65 (toggle-korean-input-method)) |
24717
ea66a10b8c12
* language/korea-util.el (isearch-toggle-korean-input-method):
Kenichi Handa <handa@m17n.org>
parents:
22987
diff
changeset
|
66 (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
|
67 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
|
68 (setq input-method-function nil) |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
69 (isearch-update)) |
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-hangul-switch-symbol-ksc () |
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 (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
|
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-hanja () |
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-hanja)) |
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 ;; Information for setting and exiting Korean environment. |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
90 (defvar korean-key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
91 `((global [?\S- ] toggle-korean-input-method nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
92 (global [C-f9] quail-hangul-switch-symbol-ksc nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
93 (global [f9] quail-hangul-switch-hanja nil) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
94 (,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
|
95 (,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
|
96 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil))) |
20442 | 97 |
98 ;;;###autoload | |
99 (defun setup-korean-environment () | |
100 "Setup multilingual environment (MULE) for Korean." | |
101 (interactive) | |
22987
708271862495
(setup-XXX-environment): Just call set-language-environment. If
Kenichi Handa <handa@m17n.org>
parents:
22617
diff
changeset
|
102 (set-language-environment "Korean")) |
20442 | 103 |
22987
708271862495
(setup-XXX-environment): Just call set-language-environment. If
Kenichi Handa <handa@m17n.org>
parents:
22617
diff
changeset
|
104 ;;;###autoload |
708271862495
(setup-XXX-environment): Just call set-language-environment. If
Kenichi Handa <handa@m17n.org>
parents:
22617
diff
changeset
|
105 (defun setup-korean-environment-internal () |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
106 (let ((key-bindings korean-key-bindings)) |
20442 | 107 (while key-bindings |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
108 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
109 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
110 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
111 old-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
112 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
113 (progn |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
114 (setq old-def (global-key-binding key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
115 (global-set-key key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
116 (setq old-def (lookup-key (car this) key)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
117 (define-key (car this) key new-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
118 (setcar (nthcdr 3 this) old-def)) |
20442 | 119 (setq key-bindings (cdr key-bindings))))) |
120 | |
121 (defun exit-korean-environment () | |
122 "Exit Korean language environment." | |
22617
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
123 (let ((key-bindings korean-key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
124 (while key-bindings |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
125 (let* ((this (car key-bindings)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
126 (key (nth 1 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
127 (new-def (nth 2 this)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
128 (old-def (nth 3 this))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
129 (if (eq (car this) 'global) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
130 (if (eq (global-key-binding key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
131 (global-set-key key old-def)) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
132 (if (eq (lookup-key (car this) key) new-def) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
133 (define-key (car this) key old-def)))) |
bcb4a7a67d13
(isearch-toggle-korean-input-method,
Kenichi Handa <handa@m17n.org>
parents:
20738
diff
changeset
|
134 (setq key-bindings (cdr key-bindings))))) |
20442 | 135 |
136 ;; | |
137 (provide 'korea-util) | |
138 | |
139 ;;; korean-util.el ends here |