Mercurial > emacs
comparison lisp/international/mule-util.el @ 24027:660b6f8b7928
(decompose-region): Do decomposition
on temporary unibyte buffer.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 08 Jan 1999 04:19:24 +0000 |
parents | 3d9e32528ca1 |
children | 31a8f281b188 |
comparison
equal
deleted
inserted
replaced
24026:8313b191de2c | 24027:660b6f8b7928 |
---|---|
334 "Decompose all composite characters in the current region. | 334 "Decompose all composite characters in the current region. |
335 Composite characters are broken up into individual components. | 335 Composite characters are broken up into individual components. |
336 When called from a program, expects two arguments, | 336 When called from a program, expects two arguments, |
337 positions (integers or markers) specifying the region." | 337 positions (integers or markers) specifying the region." |
338 (interactive "r") | 338 (interactive "r") |
339 (save-excursion | 339 (let ((buf (current-buffer)) |
340 (save-restriction | 340 (cmpchar-head (char-to-string leading-code-composition))) |
341 (narrow-to-region start end) | 341 (with-temp-buffer |
342 (insert-buffer-substring buf start end) | |
343 (set-buffer-multibyte nil) | |
342 (goto-char (point-min)) | 344 (goto-char (point-min)) |
343 (let ((cmpchar-head (char-to-string leading-code-composition))) | 345 (while (search-forward cmpchar-head nil t) |
344 (while (search-forward cmpchar-head nil t) | 346 (if (looking-at "[\240-\377][\240-\377][\240-\377][\240-\377]+") |
345 (let ((ch (preceding-char))) | 347 (let* ((from (1- (point))) |
346 (if (>= ch min-composite-char) | 348 (to (match-end 0)) |
347 (progn | 349 (str (string-as-multibyte (buffer-substring from to)))) |
348 (delete-char -1) | 350 (if (cmpcharp (string-to-char str)) |
349 (insert (decompose-composite-char ch))) | 351 (progn |
350 (forward-char 1)))))))) | 352 (delete-region from to) |
353 (insert (string-as-unibyte (decompose-string str)))) | |
354 (goto-char to))))) | |
355 (set-buffer-multibyte t) | |
356 (let ((tempbuf (current-buffer))) | |
357 (save-excursion | |
358 (set-buffer buf) | |
359 (goto-char start) | |
360 (delete-region start end) | |
361 (insert-buffer tempbuf)))))) | |
351 | 362 |
352 ;;;###autoload | 363 ;;;###autoload |
353 (defun decompose-string (string) | 364 (defun decompose-string (string) |
354 "Decompose all composite characters in STRING." | 365 "Decompose all composite characters in STRING." |
355 (let ((len (length string)) | 366 (let ((len (length string)) |