Function: ucs-normalize-region
ucs-normalize-region is a byte-compiled function defined in
ucs-normalize.el.gz.
Signature
(ucs-normalize-region FROM TO QUICK-CHECK-REGEXP TRANSLATION-TABLE COMPOSITION-PREDICATE)
Documentation
Normalize region from FROM to TO.
QUICK-CHECK-REGEXP is applied for searching the region. TRANSLATION-TABLE will be used to decompose region. COMPOSITION-PREDICATE will be used to compose region.
Source Code
;; Defined in /usr/src/emacs/lisp/international/ucs-normalize.el.gz
(defun ucs-normalize-region
(from to quick-check-regexp translation-table composition-predicate)
"Normalize region from FROM to TO.
QUICK-CHECK-REGEXP is applied for searching the region.
TRANSLATION-TABLE will be used to decompose region.
COMPOSITION-PREDICATE will be used to compose region."
(save-excursion
(save-restriction
(narrow-to-region from to)
(goto-char (point-min))
(let (start-pos starter)
(while (re-search-forward quick-check-regexp nil t)
(setq starter (string-to-char (match-string 0)))
(setq start-pos (match-beginning 0))
(ucs-normalize-block
;; from
(if (or (= start-pos (point-min))
(and (= 0 (ucs-normalize-ccc starter))
(not (memq starter ucs-normalize-combining-chars))))
start-pos (1- start-pos))
;; to
(if (looking-at ucs-normalize-combining-chars-regexp)
(match-end 0) (1+ start-pos))
translation-table composition-predicate))))))