aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1999-01-08 04:19:24 +0000
committerKenichi Handa1999-01-08 04:19:24 +0000
commitbc10f81b82bad77ff1b3717af899108d5b1feb7c (patch)
tree9f2fd27885dcab2389f7faf1bae6cfeabcad3b26
parenta9fb0b585983dcda21a4aaff82f26ce42fbddbb0 (diff)
downloademacs-bc10f81b82bad77ff1b3717af899108d5b1feb7c.tar.gz
emacs-bc10f81b82bad77ff1b3717af899108d5b1feb7c.zip
(decompose-region): Do decomposition
on temporary unibyte buffer.
-rw-r--r--lisp/international/mule-util.el33
1 files changed, 22 insertions, 11 deletions
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index 56b85b1778f..0aac9b32328 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -336,18 +336,29 @@ Composite characters are broken up into individual components.
336When called from a program, expects two arguments, 336When called from a program, expects two arguments,
337positions (integers or markers) specifying the region." 337positions (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)