annotate lisp/language/korea-util.el @ 24280:40703a998d73

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