From: Kenichi Handa Date: Mon, 26 Oct 1998 08:00:11 +0000 (+0000) Subject: (thai-pre-write-conversion): Cancel previous X-Git-Tag: emacs-20.4~1403 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3de546452ed0a7c2167dfe7fef210880b65a98de;p=emacs.git (thai-pre-write-conversion): Cancel previous change, use generate-new-buffer instead of get-buffer-create. --- diff --git a/lisp/language/thai-util.el b/lisp/language/thai-util.el index 1bb9beb3c2b..fd48ff4c022 100644 --- a/lisp/language/thai-util.el +++ b/lisp/language/thai-util.el @@ -32,6 +32,12 @@ ;; Setting information of Thai characters. +(defvar thai-category-table (copy-category-table)) +(or (category-docstring ?+ thai-category-table) + (define-category ?+ "Thai consonant" thai-category-table)) +(or (category-docstring ?- thai-category-table) + (define-category ?- "Thai diacritical mark" thai-category-table)) + (let ((l '((?,T!(B consonant "LETTER KO KAI") ; 0xA1 (?,T"(B consonant "LETTER KHO KHAI") ; 0xA2 (?,T#(B consonant "LETTER KHO KHUAT") ; 0xA3 @@ -130,10 +136,16 @@ elm) (while l (setq elm (car l)) - (put-char-code-property (car elm) 'phonetic-type (car (cdr elm))) + (let ((ptype (nth 1 elm))) + (put-char-code-property (car elm) 'phonetic-type ptype) + (if (eq ptype 'consonant) + (modify-category-entry (car elm) ?+ thai-category-table) + (if (memq ptype '(vowel-upper vowel-lower tone)) + (modify-category-entry (car elm) ?- thai-category-table)))) (put-char-code-property (car elm) 'name (nth 2 elm)) (setq l (cdr l)))) + ;;;###autoload (defun thai-compose-region (beg end) "Compose Thai characters in the region. @@ -144,9 +156,12 @@ positions (integers or markers) specifying the region." (narrow-to-region beg end) (decompose-region (point-min) (point-max)) (goto-char (point-min)) - (while (re-search-forward "\\c0\\(\\c2\\|\\c3\\|\\c4\\)+" nil t) - (if (aref (char-category-set (char-after (match-beginning 0))) ?t) - (compose-region (match-beginning 0) (match-end 0)))))) + (let ((current-ctbl (category-table))) + (set-category-table thai-category-table) + (unwind-protect + (while (re-search-forward "\\c+\\c-+" nil t) + (compose-region (match-beginning 0) (match-end 0))) + (set-category-table current-ctbl))))) ;;;###autoload (defun thai-compose-buffer () @@ -167,11 +182,11 @@ positions (integers or markers) specifying the region." ;;;###autoload (defun thai-pre-write-conversion (from to) (let ((old-buf (current-buffer))) - (with-temp-buffer - (if (stringp from) - (insert from) - (insert-buffer-substring old-buf from to)) - (decompose-region (point-min) (point-max))) + (set-buffer (generate-new-buffer " *temp*")) + (if (stringp from) + (insert from) + (insert-buffer-substring old-buf from to)) + (decompose-region (point-min) (point-max)) ;; Should return nil as annotations. nil))