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