Added wording for the regex files and the --ignore-case-regex option.
[emacs.git] / lisp / language / korea-util.el
blob4b4292d52ba07a2c8ddcc962a7a0da9668e4ba51
1 ;;; korea-util.el --- utilities for Korean
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
5 ;; Keywords: mule, multilingual, Korean
7 ;; This file is part of GNU Emacs.
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.
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.
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.
24 ;;; Code:
26 ;;;###autoload
27 (defvar default-korean-keyboard
28 (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") ""))
29 "3"
30 "")
31 "*The kind of Korean keyboard for Korean input method.
32 \"\" for 2, \"3\" for 3.")
34 ;; functions useful for Korean text input
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))))
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"))))
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)))))
63 ;; The following three commands are set in isearch-mode-map.
65 (defun isearch-toggle-korean-input-method ()
66 (interactive)
67 (let ((overriding-terminal-local-map nil))
68 (toggle-korean-input-method))
69 (setq isearch-input-method-function input-method-function
70 isearch-input-method-local-p t)
71 (setq input-method-function nil)
72 (isearch-update))
74 (defun isearch-hangul-switch-symbol-ksc ()
75 (interactive)
76 (let ((overriding-terminal-local-map nil))
77 (quail-hangul-switch-symbol-ksc))
78 (setq isearch-input-method-function input-method-function
79 isearch-input-method-local-p t)
80 (setq input-method-function nil)
81 (isearch-update))
83 (defun isearch-hangul-switch-hanja ()
84 (interactive)
85 (let ((overriding-terminal-local-map nil))
86 (quail-hangul-switch-hanja))
87 (setq isearch-input-method-function input-method-function
88 isearch-input-method-local-p t)
89 (setq input-method-function nil)
90 (isearch-update))
92 ;; Information for setting and exiting Korean environment.
93 (defvar korean-key-bindings
94 `((global [?\S- ] toggle-korean-input-method nil)
95 (global [C-f9] quail-hangul-switch-symbol-ksc nil)
96 (global [f9] quail-hangul-switch-hanja nil)
97 (,isearch-mode-map [?\S- ] isearch-toggle-korean-input-method nil)
98 (,isearch-mode-map [C-f9] isearch-hangul-switch-symbol-ksc nil)
99 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil)))
101 ;;;###autoload
102 (defun setup-korean-environment ()
103 "Setup multilingual environment (MULE) for Korean."
104 (interactive)
105 (set-language-environment "Korean"))
107 ;;;###autoload
108 (defun setup-korean-environment-internal ()
109 (let ((key-bindings korean-key-bindings))
110 (while key-bindings
111 (let* ((this (car key-bindings))
112 (key (nth 1 this))
113 (new-def (nth 2 this))
114 old-def)
115 (if (eq (car this) 'global)
116 (progn
117 (setq old-def (global-key-binding key))
118 (global-set-key key new-def))
119 (setq old-def (lookup-key (car this) key))
120 (define-key (car this) key new-def))
121 (setcar (nthcdr 3 this) old-def))
122 (setq key-bindings (cdr key-bindings)))))
124 (defun exit-korean-environment ()
125 "Exit Korean language environment."
126 (let ((key-bindings korean-key-bindings))
127 (while key-bindings
128 (let* ((this (car key-bindings))
129 (key (nth 1 this))
130 (new-def (nth 2 this))
131 (old-def (nth 3 this)))
132 (if (eq (car this) 'global)
133 (if (eq (global-key-binding key) new-def)
134 (global-set-key key old-def))
135 (if (eq (lookup-key (car this) key) new-def)
136 (define-key (car this) key old-def))))
137 (setq key-bindings (cdr key-bindings)))))
140 (provide 'korea-util)
142 ;;; korean-util.el ends here