diff options
| author | Kenichi Handa | 1998-10-26 08:00:11 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-10-26 08:00:11 +0000 |
| commit | 3de546452ed0a7c2167dfe7fef210880b65a98de (patch) | |
| tree | 55a8025376ed91ab09d8bea49a16b5d37546b5a0 | |
| parent | 76d124158579b595ec6c355635aea749c169fc08 (diff) | |
| download | emacs-3de546452ed0a7c2167dfe7fef210880b65a98de.tar.gz emacs-3de546452ed0a7c2167dfe7fef210880b65a98de.zip | |
(thai-pre-write-conversion): Cancel previous
change, use generate-new-buffer instead of get-buffer-create.
| -rw-r--r-- | lisp/language/thai-util.el | 33 |
1 files changed, 24 insertions, 9 deletions
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 @@ | |||
| 32 | 32 | ||
| 33 | ;; Setting information of Thai characters. | 33 | ;; Setting information of Thai characters. |
| 34 | 34 | ||
| 35 | (defvar thai-category-table (copy-category-table)) | ||
| 36 | (or (category-docstring ?+ thai-category-table) | ||
| 37 | (define-category ?+ "Thai consonant" thai-category-table)) | ||
| 38 | (or (category-docstring ?- thai-category-table) | ||
| 39 | (define-category ?- "Thai diacritical mark" thai-category-table)) | ||
| 40 | |||
| 35 | (let ((l '((?,T!(B consonant "LETTER KO KAI") ; 0xA1 | 41 | (let ((l '((?,T!(B consonant "LETTER KO KAI") ; 0xA1 |
| 36 | (?,T"(B consonant "LETTER KHO KHAI") ; 0xA2 | 42 | (?,T"(B consonant "LETTER KHO KHAI") ; 0xA2 |
| 37 | (?,T#(B consonant "LETTER KHO KHUAT") ; 0xA3 | 43 | (?,T#(B consonant "LETTER KHO KHUAT") ; 0xA3 |
| @@ -130,10 +136,16 @@ | |||
| 130 | elm) | 136 | elm) |
| 131 | (while l | 137 | (while l |
| 132 | (setq elm (car l)) | 138 | (setq elm (car l)) |
| 133 | (put-char-code-property (car elm) 'phonetic-type (car (cdr elm))) | 139 | (let ((ptype (nth 1 elm))) |
| 140 | (put-char-code-property (car elm) 'phonetic-type ptype) | ||
| 141 | (if (eq ptype 'consonant) | ||
| 142 | (modify-category-entry (car elm) ?+ thai-category-table) | ||
| 143 | (if (memq ptype '(vowel-upper vowel-lower tone)) | ||
| 144 | (modify-category-entry (car elm) ?- thai-category-table)))) | ||
| 134 | (put-char-code-property (car elm) 'name (nth 2 elm)) | 145 | (put-char-code-property (car elm) 'name (nth 2 elm)) |
| 135 | (setq l (cdr l)))) | 146 | (setq l (cdr l)))) |
| 136 | 147 | ||
| 148 | |||
| 137 | ;;;###autoload | 149 | ;;;###autoload |
| 138 | (defun thai-compose-region (beg end) | 150 | (defun thai-compose-region (beg end) |
| 139 | "Compose Thai characters in the region. | 151 | "Compose Thai characters in the region. |
| @@ -144,9 +156,12 @@ positions (integers or markers) specifying the region." | |||
| 144 | (narrow-to-region beg end) | 156 | (narrow-to-region beg end) |
| 145 | (decompose-region (point-min) (point-max)) | 157 | (decompose-region (point-min) (point-max)) |
| 146 | (goto-char (point-min)) | 158 | (goto-char (point-min)) |
| 147 | (while (re-search-forward "\\c0\\(\\c2\\|\\c3\\|\\c4\\)+" nil t) | 159 | (let ((current-ctbl (category-table))) |
| 148 | (if (aref (char-category-set (char-after (match-beginning 0))) ?t) | 160 | (set-category-table thai-category-table) |
| 149 | (compose-region (match-beginning 0) (match-end 0)))))) | 161 | (unwind-protect |
| 162 | (while (re-search-forward "\\c+\\c-+" nil t) | ||
| 163 | (compose-region (match-beginning 0) (match-end 0))) | ||
| 164 | (set-category-table current-ctbl))))) | ||
| 150 | 165 | ||
| 151 | ;;;###autoload | 166 | ;;;###autoload |
| 152 | (defun thai-compose-buffer () | 167 | (defun thai-compose-buffer () |
| @@ -167,11 +182,11 @@ positions (integers or markers) specifying the region." | |||
| 167 | ;;;###autoload | 182 | ;;;###autoload |
| 168 | (defun thai-pre-write-conversion (from to) | 183 | (defun thai-pre-write-conversion (from to) |
| 169 | (let ((old-buf (current-buffer))) | 184 | (let ((old-buf (current-buffer))) |
| 170 | (with-temp-buffer | 185 | (set-buffer (generate-new-buffer " *temp*")) |
| 171 | (if (stringp from) | 186 | (if (stringp from) |
| 172 | (insert from) | 187 | (insert from) |
| 173 | (insert-buffer-substring old-buf from to)) | 188 | (insert-buffer-substring old-buf from to)) |
| 174 | (decompose-region (point-min) (point-max))) | 189 | (decompose-region (point-min) (point-max)) |
| 175 | ;; Should return nil as annotations. | 190 | ;; Should return nil as annotations. |
| 176 | nil)) | 191 | nil)) |
| 177 | 192 | ||