annotate lisp/language/korea-util.el @ 22363:d00f146c3e9d

#include sys/file.h (sys_access): Provide our own implementation which recognizes D_OK. (is_exec): New function. (stat): Use it. (init_environment): Set TMPDIR to an existing directory. Abort if none of the usual places is available. (sys_rename): On Windows 95, choose a temp name that includes the original file's base name and use an explicit loop rather than calling mktemp. Only attempt to unlink the newname if the rename fails, rather than second-guessing whether the old and new names refer to the same file.
author Karl Heuer <kwzh@gnu.org>
date Fri, 05 Jun 1998 16:08:32 +0000
parents f510736ce3d1
children bcb4a7a67d13
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
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
60 ;; Information for exiting Korean environment.
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
61 (defvar exit-korean-environment-data nil)
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
62
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
63 ;;;###autoload
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
64 (defun setup-korean-environment ()
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
65 "Setup multilingual environment (MULE) for Korean."
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
66 (interactive)
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
67 (setup-english-environment)
20738
f510736ce3d1 In setup-LANGUAGE-environment functions,
Kenichi Handa <handa@m17n.org>
parents: 20442
diff changeset
68 (set-language-environment-coding-systems "Korean")
20442
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
69
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
70 (setq default-input-method "korean-hangul")
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
71
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
72 (let ((key-bindings '(([?\S- ] . toggle-korean-input-method)
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
73 ([C-f9] . quail-hangul-switch-symbol-ksc)
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
74 ([f9] . quail-hangul-switch-hanja))))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
75 (while key-bindings
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
76 (let ((prev-binding (global-key-binding (car (car key-bindings)))))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
77 (setq exit-korean-environment-data
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
78 (cons (cons (car (car key-bindings)) prev-binding)
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
79 exit-korean-environment-data)))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
80 (global-set-key (car (car key-bindings)) (cdr (car key-bindings)))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
81 (setq key-bindings (cdr key-bindings)))))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
82
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
83 (defun exit-korean-environment ()
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
84 "Exit Korean language environment."
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
85 (while exit-korean-environment-data
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
86 (global-set-key (car (car exit-korean-environment-data))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87 (cdr (car exit-korean-environment-data)))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
88 (setq exit-korean-environment-data
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
89 (cdr exit-korean-environment-data))))
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
90
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
91 ;;
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
92 (provide 'korea-util)
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
93
da84d48fd13b Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
94 ;;; korean-util.el ends here