(latexenc-find-file-coding-system): Don't inherit the EOL part of the
[emacs.git] / lisp / language / korea-util.el
blobde940f5317f3b8ecd0ba1043d2c8dda02b04e1ba
1 ;;; korea-util.el --- utilities for Korean
3 ;; Copyright (C) 1997, 1999 Free Software Foundation, Inc.
4 ;; Copyright (C) 1997, 1998, 1999
5 ;; National Institute of Advanced Industrial Science and Technology (AIST)
6 ;; Registration Number H14PRO021
8 ;; Keywords: mule, multilingual, Korean
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
27 ;;; Commentary:
29 ;;; Code:
31 ;;;###autoload
32 (defvar default-korean-keyboard
33 (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") ""))
34 "3"
35 "")
36 "*The kind of Korean keyboard for Korean input method.
37 \"\" for 2, \"3\" for 3.")
39 ;; functions useful for Korean text input
41 (defun toggle-korean-input-method ()
42 "Turn on or off a Korean text input method for the current buffer."
43 (interactive)
44 (if current-input-method
45 (inactivate-input-method)
46 (activate-input-method
47 (concat "korean-hangul" default-korean-keyboard))))
49 (defun quail-hangul-switch-symbol-ksc (&rest ignore)
50 "Swith to/from Korean symbol package."
51 (interactive "i")
52 (and current-input-method
53 (if (string-equal current-input-method "korean-symbol")
54 (activate-input-method (concat "korean-hangul"
55 default-korean-keyboard))
56 (activate-input-method "korean-symbol"))))
58 (defun quail-hangul-switch-hanja (&rest ignore)
59 "Swith to/from Korean hanja package."
60 (interactive "i")
61 (and current-input-method
62 (if (string-match "korean-hanja" current-input-method)
63 (activate-input-method (concat "korean-hangul"
64 default-korean-keyboard))
65 (activate-input-method (concat "korean-hanja"
66 default-korean-keyboard)))))
68 ;; The following three commands are set in isearch-mode-map.
70 (defun isearch-toggle-korean-input-method ()
71 (interactive)
72 (let ((overriding-terminal-local-map nil))
73 (toggle-korean-input-method))
74 (setq isearch-input-method-function input-method-function
75 isearch-input-method-local-p t)
76 (setq input-method-function nil)
77 (isearch-update))
79 (defun isearch-hangul-switch-symbol-ksc ()
80 (interactive)
81 (let ((overriding-terminal-local-map nil))
82 (quail-hangul-switch-symbol-ksc))
83 (setq isearch-input-method-function input-method-function
84 isearch-input-method-local-p t)
85 (setq input-method-function nil)
86 (isearch-update))
88 (defun isearch-hangul-switch-hanja ()
89 (interactive)
90 (let ((overriding-terminal-local-map nil))
91 (quail-hangul-switch-hanja))
92 (setq isearch-input-method-function input-method-function
93 isearch-input-method-local-p t)
94 (setq input-method-function nil)
95 (isearch-update))
97 ;; Information for setting and exiting Korean environment.
98 (defvar korean-key-bindings
99 `((global [?\S- ] toggle-korean-input-method nil)
100 (global [C-f9] quail-hangul-switch-symbol-ksc nil)
101 (global [f9] quail-hangul-switch-hanja nil)
102 (,isearch-mode-map [?\S- ] isearch-toggle-korean-input-method nil)
103 (,isearch-mode-map [C-f9] isearch-hangul-switch-symbol-ksc nil)
104 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil)))
106 ;;;###autoload
107 (defun setup-korean-environment-internal ()
108 (let ((key-bindings korean-key-bindings))
109 (while key-bindings
110 (let* ((this (car key-bindings))
111 (key (nth 1 this))
112 (new-def (nth 2 this))
113 old-def)
114 (if (eq (car this) 'global)
115 (progn
116 (setq old-def (global-key-binding key))
117 (global-set-key key new-def))
118 (setq old-def (lookup-key (car this) key))
119 (define-key (car this) key new-def))
120 (setcar (nthcdr 3 this) old-def))
121 (setq key-bindings (cdr key-bindings)))))
123 (defun exit-korean-environment ()
124 "Exit Korean language environment."
125 (let ((key-bindings korean-key-bindings))
126 (while key-bindings
127 (let* ((this (car key-bindings))
128 (key (nth 1 this))
129 (new-def (nth 2 this))
130 (old-def (nth 3 this)))
131 (if (eq (car this) 'global)
132 (if (eq (global-key-binding key) new-def)
133 (global-set-key key old-def))
134 (if (eq (lookup-key (car this) key) new-def)
135 (define-key (car this) key old-def))))
136 (setq key-bindings (cdr key-bindings)))))
139 (provide 'korea-util)
141 ;;; arch-tag: b17d0981-05da-4577-99f8-1db87fff8b44
142 ;;; korea-util.el ends here