annotate lisp/mule/vietnamese.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1 ;; Vietnamese language specific setup for Mule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2 ;; Copyright (C) 1992 Free Software Foundation, Inc.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
3 ;; This file is part of Mule (MULtilingual Enhancement of GNU Emacs).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
4 ;; This file contains European characters.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
5
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
6 ;; Mule is free software distributed in the form of patches to GNU Emacs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
7 ;; You can redistribute it and/or modify
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
8 ;; it under the terms of the GNU General Public License as published by
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
9 ;; the Free Software Foundation; either version 1, or (at your option)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
10 ;; any later version.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
11
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
12 ;; Mule is distributed in the hope that it will be useful,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
15 ;; GNU General Public License for more details.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
16
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
18 ;; along with GNU Emacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
20 ;; Boston, MA 02111-1307, USA.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
21
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
22 ;;; 93.5.25 created for Mule Ver.0.9.8 by K.Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
23 ;;; 93.7.22 modified for Mule Ver.0.9.8 by K.Handa <handa@etl.go.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
24
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
25 (defconst viqr-regexp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
26 "[aeiouyAEIOUY]\\([(^+]?['`?~.]\\|[(^+]\\)\\|[Dd][Dd]")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
27
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
28 ;;;###autoload
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
29 (defun vn-compose-viqr (from to)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
30 "Convert 'VIQR' mnemonics of the current region to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
31 pre-composed Vietnamese characaters."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
32 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
33 (let (quail-current-package map key def)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
34 (quail-use-package "viqr")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
35 (setq map (quail-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
36 (save-restriction
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
37 (narrow-to-region from to)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
38 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
39 (while (re-search-forward viqr-regexp 0 t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
40 (setq key (buffer-substring (match-beginning 0) (match-end 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
41 (setq def (lookup-key map key))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
42 (if (numberp def)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
43 (if (> def 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
44 (setq key (substring key 0 (1- def))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
45 def (lookup-key map key))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
46 (if (keymapp def)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
47 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
48 (goto-char (match-beginning 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
49 (delete-region (point) (+ (point) (length key)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
50 (insert (quail-get-candidate def t))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
51
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
52 ;;;###autoload
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
53 (defun vn-compose-viqr-buffer ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
54 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
55 (vn-compose-viqr (point-min) (point-max)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
56
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
57 ;;;###autoload
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
58 (defun vn-decompose-viqr (from to)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
59 "Convert pre-composed Vietnamese characaters of the current region to
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
60 'VIQR' mnemonics."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
61 (interactive "r")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
62 (let (quail-current-package decode-map key def)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
63 (quail-use-package "viqr")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
64 (setq decode-map (quail-decode-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
65 (save-restriction
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
66 (narrow-to-region from to)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
67 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
68 (while (re-search-forward "\\cv" 0 t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
69 (setq def (preceding-char))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
70 (if (setq key (assq def decode-map))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
71 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
72 (delete-char -1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
73 (insert (cdr key))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
74
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
75 ;;;###autoload
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
76 (defun vn-decompose-viqr-buffer ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
77 (interactive)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
78 (vn-decompose-viqr (point-min) (point-max)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
79
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
80 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
81 (provide 'viet)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
82 (provide 'vietnamese)