]> git.eshelyaron.com Git - emacs.git/commitdiff
(thai-post-read-conversion): Handle Thai
authorKenichi Handa <handa@m17n.org>
Tue, 5 Jan 1999 02:38:37 +0000 (02:38 +0000)
committerKenichi Handa <handa@m17n.org>
Tue, 5 Jan 1999 02:38:37 +0000 (02:38 +0000)
composition sequence correctly here instead of calling
thai-compose-region.

lisp/language/thai-util.el

index fd48ff4c022ea6a2518d67eb5959cfb8b653bce8..cce6f12696b45c43ffbc42f986312c43ebc6c602 100644 (file)
@@ -173,9 +173,33 @@ positions (integers or markers) specifying the region."
 (defun thai-post-read-conversion (len)
   (save-excursion
     (save-restriction
-      (let ((buffer-modified-p (buffer-modified-p)))
-       (narrow-to-region (point) (+ (point) len))
-       (thai-compose-region (point-min) (point-max))
+      (let ((buffer-modified-p (buffer-modified-p))
+           (category-table (category-table))
+           (buf (current-buffer))
+           (workbuf (generate-new-buffer "*thai-work*"))
+           (pos (point))
+           start end str)
+       (save-excursion
+         (set-buffer workbuf)
+         (setq buffer-undo-list t))
+       (narrow-to-region pos (+ pos len))
+       (set-category-table thai-category-table)
+       (unwind-protect
+           (progn
+             (while (re-search-forward "\\c+\\c-+" nil t)
+               (setq start (match-beginning 0)
+                     end (point)
+                     str (compose-string (buffer-substring start end)))
+               (set-buffer workbuf)
+               (if (< pos start)
+                   (insert-buffer-substring buf pos start))
+               (insert str)
+               (set-buffer buf)
+               (setq pos end))
+             (delete-region (point-min) (point))
+             (insert-buffer-substring workbuf))
+         (set-category-table category-table)
+         (kill-buffer workbuf))
        (set-buffer-modified-p buffer-modified-p)
        (- (point-max) (point-min))))))