]> code.delx.au - gnu-emacs/blobdiff - lisp/language/lao-util.el
Merge from emacs--devo--0
[gnu-emacs] / lisp / language / lao-util.el
index 02a16158bd4e15a035aff9d32649ac059e09e0f1..359f4f8772494cba1f27caa95fc660a923b6e82c 100644 (file)
@@ -1,9 +1,15 @@
-;;; lao-util.el --- utilities for Lao
+;;; lao-util.el --- utilities for Lao -*- coding: iso-2022-7bit; -*-
 
-;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
-;; Licensed to the Free Software Foundation.
+;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;;   Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H14PRO021
+;; Copyright (C) 2003
+;;   National Institute of Advanced Industrial Science and Technology (AIST)
+;;   Registration Number H13PRO009
 
-;; Keywords: multilingual, Lao
+;; Keywords: multilingual, Lao, i18n
 
 ;; This file is part of GNU Emacs.
 
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
-;;; Code:
+;;; Commentary:
 
-;;;###autoload
-(defun setup-lao-environment ()
-  "Setup multilingual environment (MULE) for Lao."
-  (interactive)
-  (set-language-environment "Lao"))
+;;; Code:
 
 ;; Setting information of Thai characters.
 
@@ -89,7 +91,7 @@
           (?\e(1Q\e(B vowel-upper "VOWEL SIGN MAI KAN")
           (?\e(1R\e(B vowel-base "VOWEL SIGN SARA AR")
           (?\e(1S\e(B vowel-base "VOWEL SIGN SARA AM")
-          (?\e(1T\e(B vowel-upper "VOWEL SIGN SARA I") 
+          (?\e(1T\e(B vowel-upper "VOWEL SIGN SARA I")
           (?\e(1U\e(B vowel-upper "VOWEL SIGN SARA II")
           (?\e(1V\e(B vowel-upper "VOWEL SIGN SARA EU")
           (?\e(1W\e(B vowel-upper "VOWEL SIGN SARA UR")
           (?\e(1c\e(B vowel-base "VOWEL SIGN SARA EI MAI MUAN\"")
           (?\e(1d\e(B vowel-base "VOWEL SIGN SARA AI MAI MAY")
           (?\e(1e\e(B invalid nil)
-          (?\e(1f\e(B special "KO LA (REPETITION)") 
+          (?\e(1f\e(B special "KO LA (REPETITION)")
           (?\e(1g\e(B invalid nil)
           (?\e(1h\e(B tone "TONE MAI EK")
           (?\e(1i\e(B tone "TONE MAI THO")
           (?\e(1{\e(B invalid nil)
           (?\e(1|\e(B consonant "LETTER NHOR NHUU" "MOUSE")
           (?\e(1}\e(B consonant "LETTER MHOR MHAR" "DOG")
-          (?\e(1~\e(B invalid nil)
-          ))
+          (?\e(1~\e(B invalid nil)))
       elm)
   (while l
     (setq elm (car l) l (cdr l))
 ;; CV -> C, CT -> C, CVT -> C, Cv -> C, CvT -> C
 ;;                                   v         v
 ;;                             T
-;;        V         T          V                   T
-;; CsV -> C, CsT -> C, CsVT -> C, Csv -> C, CvT -> C
-;;        s         s          s         s         s
-;;                                       v         v
+;;        V         T          V                    T
+;; CsV -> C, CsT -> C, CsVT -> C, Csv -> C, CsvT -> C
+;;        s         s          s         s          s
+;;                                       v          v
 
 
 ;; where C: consonant, V: vowel upper, v: vowel lower,
@@ -491,19 +492,20 @@ syllable.  In that case, FROM and TO are indexes to STR."
       lao-str)))
 
 ;;;###autoload
-(defun lao-composition-function (from to pattern &optional string)
-  "Compose Lao text in the region FROM and TO.
-The text matches the regular expression PATTERN.
-Optional 4th argument STRING, if non-nil, is a string containing text
-to compose.
-
-The return value is number of composed characters."
-  (if (< (1+ from) to)
-      (prog1 (- to from)
-       (if string
-           (compose-string from to)
-         (compose-region from to))
-       (- to from))))
+(defun lao-composition-function (pos &optional string)
+  (setq pos (1- pos))
+  (with-category-table lao-category-table
+    (if string
+       (if (and (>= pos 0)
+                (eq (string-match lao-composition-pattern string pos) pos))
+           (prog1 (match-end 0)
+             (compose-string string pos (match-end 0))))
+      (if (>= pos (point-min))
+         (save-excursion
+           (goto-char pos)
+           (if (looking-at lao-composition-pattern)
+               (prog1 (match-end 0)
+                 (compose-region pos (match-end 0)))))))))
 
 ;;;###autoload
 (defun lao-compose-region (from to)
@@ -518,4 +520,5 @@ The return value is number of composed characters."
 ;;
 (provide 'lao-util)
 
+;;; arch-tag: 1f828781-3cb8-4695-88af-8f33222338ce
 ;;; lao-util.el ends here