comparison lisp/mule/korea-util.el @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents
children 2923009caf47
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
1 ;;; korea-util.el --- utilities for Korean -*- coding: iso-2022-7bit; -*-
2
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4
5 ;; Keywords: mule, multilingual, Korean
6
7 ;; This file is part of XEmacs.
8
9 ;; XEmacs is free software; you can redistribute it and/or modify it
10 ;; 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 ;; XEmacs is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 ;; 02111-1307, USA.
23
24 ;;; Synched up with: Emacs 21.0.103 (language/korea-util.el).
25
26 ;;; Code:
27
28 ;;;###autoload
29 (defvar default-korean-keyboard
30 (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") ""))
31 "3"
32 "")
33 "*The kind of Korean keyboard for Korean input method.
34 \"\" for 2, \"3\" for 3.")
35
36 ;; functions useful for Korean text input
37
38 (defun toggle-korean-input-method ()
39 "Turn on or off a Korean text input method for the current buffer."
40 (interactive)
41 (if current-input-method
42 (inactivate-input-method)
43 (activate-input-method
44 (concat "korean-hangul" default-korean-keyboard))))
45
46 (defun quail-hangul-switch-symbol-ksc (&rest ignore)
47 "Swith to/from Korean symbol package."
48 (interactive "i")
49 (and current-input-method
50 (if (string-equal current-input-method "korean-symbol")
51 (activate-input-method (concat "korean-hangul"
52 default-korean-keyboard))
53 (activate-input-method "korean-symbol"))))
54
55 (defun quail-hangul-switch-hanja (&rest ignore)
56 "Swith to/from Korean hanja package."
57 (interactive "i")
58 (and current-input-method
59 (if (string-match "korean-hanja" current-input-method)
60 (activate-input-method (concat "korean-hangul"
61 default-korean-keyboard))
62 (activate-input-method (concat "korean-hanja"
63 default-korean-keyboard)))))
64
65 ;; The following three commands are set in isearch-mode-map.
66
67 (defun isearch-toggle-korean-input-method ()
68 (interactive)
69 (let ((overriding-terminal-local-map nil))
70 (toggle-korean-input-method))
71 (setq isearch-input-method-function input-method-function
72 isearch-input-method-local-p t)
73 (setq input-method-function nil)
74 (isearch-update))
75
76 (defun isearch-hangul-switch-symbol-ksc ()
77 (interactive)
78 (let ((overriding-terminal-local-map nil))
79 (quail-hangul-switch-symbol-ksc))
80 (setq isearch-input-method-function input-method-function
81 isearch-input-method-local-p t)
82 (setq input-method-function nil)
83 (isearch-update))
84
85 (defun isearch-hangul-switch-hanja ()
86 (interactive)
87 (let ((overriding-terminal-local-map nil))
88 (quail-hangul-switch-hanja))
89 (setq isearch-input-method-function input-method-function
90 isearch-input-method-local-p t)
91 (setq input-method-function nil)
92 (isearch-update))
93
94 ;; Information for setting and exiting Korean environment.
95 (defvar korean-key-bindings
96 `((global [?\S- ] toggle-korean-input-method nil)
97 (global [C-f9] quail-hangul-switch-symbol-ksc nil)
98 (global [f9] quail-hangul-switch-hanja nil)
99 (,isearch-mode-map [?\S- ] isearch-toggle-korean-input-method nil)
100 (,isearch-mode-map [C-f9] isearch-hangul-switch-symbol-ksc nil)
101 (,isearch-mode-map [f9] isearch-hangul-switch-hanja nil)))
102
103 ;;;###autoload
104 (defun setup-korean-environment-internal ()
105 (let ((key-bindings korean-key-bindings))
106 (while key-bindings
107 (let* ((this (car key-bindings))
108 (key (nth 1 this))
109 (new-def (nth 2 this))
110 old-def)
111 (if (eq (car this) 'global)
112 (progn
113 (setq old-def (global-key-binding key))
114 (global-set-key key new-def))
115 (setq old-def (lookup-key (car this) key))
116 (define-key (car this) key new-def))
117 (setcar (nthcdr 3 this) old-def))
118 (setq key-bindings (cdr key-bindings)))))
119
120 (defun exit-korean-environment ()
121 "Exit Korean language environment."
122 (let ((key-bindings korean-key-bindings))
123 (while key-bindings
124 (let* ((this (car key-bindings))
125 (key (nth 1 this))
126 (new-def (nth 2 this))
127 (old-def (nth 3 this)))
128 (if (eq (car this) 'global)
129 (if (eq (global-key-binding key) new-def)
130 (global-set-key key old-def))
131 (if (eq (lookup-key (car this) key) new-def)
132 (define-key (car this) key old-def))))
133 (setq key-bindings (cdr key-bindings)))))
134
135 ;;
136 (provide 'korea-util)
137
138 ;;; korean-util.el ends here