From: Kenichi Handa Date: Tue, 5 Jan 1999 04:07:10 +0000 (+0000) Subject: (thai-compose-string): New function. X-Git-Tag: emacs-20.4~955 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0a57cf5133908a31dcdd615aad5e6c24d485ee43;p=emacs.git (thai-compose-string): New function. --- diff --git a/lisp/language/thai-util.el b/lisp/language/thai-util.el index cce6f12696b..2c891d0d992 100644 --- a/lisp/language/thai-util.el +++ b/lisp/language/thai-util.el @@ -163,6 +163,25 @@ positions (integers or markers) specifying the region." (compose-region (match-beginning 0) (match-end 0))) (set-category-table current-ctbl))))) +;;;###autoload +(defun thai-compose-string (string) + "Compose Thai characters in STRING and return the resulting string." + (let ((current-ctbl (category-table))) + (set-category-table thai-category-table) + (unwind-protect + (let ((idx 0) + (new "")) + (while (string-match "\\c+\\c-+" string idx) + (if (< idx (match-beginning 0)) + (setq new + (concat new (substring string idx (match-beginning 0))))) + (setq new (concat new (compose-string (match-string 0 string)))) + (setq idx (match-end 0))) + (if (< idx (length string)) + (setq new (concat new (substring string idx)))) + new) + (set-category-table current-ctbl)))) + ;;;###autoload (defun thai-compose-buffer () "Compose Thai characters in the current buffer."