diff options
| author | Robert Pluim <rpluim@gmail.com> | 2019-07-22 20:27:59 +0200 |
|---|---|---|
| committer | Robert Pluim <rpluim@gmail.com> | 2019-07-23 19:39:06 +0200 |
| commit | f9337bc36d17a8819c0d05be8d3a1edcc34c6c79 (patch) | |
| tree | e4c06ceea14068f3b90035e6db484c4baa42bcaa /lisp/char-fold.el | |
| parent | 9a83ecb60a0dd280fe892adfe3bbefd2d55d13bd (diff) | |
| download | emacs-f9337bc36d17a8819c0d05be8d3a1edcc34c6c79.tar.gz | |
Follow decomposition chains when constructing char-fold-table
* lisp/char-fold.el (char-fold-make-table): Decompose the
decomposition of each character, adding equivalences to the original
character, until no more decompositions are left.
Diffstat (limited to 'lisp/char-fold.el')
| -rw-r--r-- | lisp/char-fold.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lisp/char-fold.el b/lisp/char-fold.el index 9d3ea17b413..a5c4e5e411b 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -78,6 +78,25 @@ (cons (char-to-string char) (aref equiv (car decomp)))))))) (funcall make-decomp-match-char decomp char) + ;; Check to see if the first char of the decomposition + ;; has a further decomposition. If so, add a mapping + ;; back from that second decomposition to the original + ;; character. This allows e.g. 'ι' (GREEK SMALL LETTER + ;; IOTA) to match both the Basic Greek block and + ;; Extended Greek block variants of IOTA + + ;; diacritical(s). Repeat until there are no more + ;; decompositions. + (let ((dec decomp) + next-decomp) + (while dec + (setq next-decomp (char-table-range table (car dec))) + (when (consp next-decomp) + (when (symbolp (car next-decomp)) + (setq next-decomp (cdr next-decomp))) + (if (not (eq (car dec) + (car next-decomp))) + (funcall make-decomp-match-char (list (car next-decomp)) char))) + (setq dec next-decomp))) ;; Do it again, without the non-spacing characters. ;; This allows 'a' to match 'ä'. (let ((simpler-decomp nil) |
