changeset 89295:ea8374ccb41f

Register devanagari-composable-pattern in indian-composable-pattern. (devanagari-composition-function): Add autoload cookie. Change arguments to conform to composition-function-table.
author Kenichi Handa <handa@m17n.org>
date Thu, 07 Nov 2002 06:29:31 +0000
parents 57eceaa28da0
children 5f226da850bf
files lisp/language/devan-util.el
diffstat 1 files changed, 18 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/language/devan-util.el	Thu Nov 07 06:29:07 2002 +0000
+++ b/lisp/language/devan-util.el	Thu Nov 07 06:29:31 2002 +0000
@@ -58,6 +58,12 @@
    "\\)")
   "Regexp matching a composable sequence of Devanagari characters.")
 
+(dolist (range '((#x0903 . #x0903)
+		 (#x0905 . #x0939)
+		 (#x0958 . #x0961)))
+  (set-char-table-range indian-composable-pattern range
+			devanagari-composable-pattern))
+
 ;;;###autoload
 (defun devanagari-compose-region (from to)
   (interactive "r")
@@ -98,21 +104,19 @@
 	dummy)
       (function (lambda (x y) (> (length x) (length y))))))))
 
-(defun devanagari-composition-function (from to pattern &optional string)
-  "Compose Devanagari characters in REGION, or STRING if specified.
-Assume that the REGION or STRING must fully match the composable
-PATTERN regexp."
-  (if string (devanagari-compose-syllable-string string)
-    (devanagari-compose-syllable-region from to))
-  (- to from))
 
-;; Register a function to compose Devanagari characters.
-(mapc
- (function (lambda (ucs)
-   (aset composition-function-table ucs
-	 (list (cons devanagari-composable-pattern
-		     'devanagari-composition-function)))))
- (nconc '(#x0903) (devanagari-range #x0905 #x0939) (devanagari-range #x0958 #x0961)))
+;;;###autoload
+(defun devanagari-composition-function (pos &optional string)
+  "Compose Devanagari characters after the position POS.
+If STRING is not nil, it is a string, and POS is an index to the string.
+In this case, compose characters after POS of the string."
+  (if string
+      ;; Not yet implemented.
+      nil
+    (goto-char pos)
+    (if (looking-at devanagari-composable-pattern)
+	(prog1 (match-end 0)
+	  (devanagari-compose-syllable-region pos (match-end 0))))))
 
 ;; Notes on conversion steps.