1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(thai-pre-write-conversion): Cancel previous

change, use generate-new-buffer instead of get-buffer-create.
This commit is contained in:
Kenichi Handa 1998-10-26 08:00:11 +00:00
parent 76d1241585
commit 3de546452e

View file

@ -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))