emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: search-default-mode char-fold-to-regexp and Greek Extended block cha


From: Robert Pluim
Subject: Re: search-default-mode char-fold-to-regexp and Greek Extended block characters
Date: Sun, 21 Jul 2019 13:03:37 +0200

>>>>> On Fri, 19 Jul 2019 21:13:02 +0300, Eli Zaretskii <address@hidden> said:

    Eli>   (get-char-code-property ?ί 'decomposition) => (943) ; (#x03af) i.e 
(?ί)
    Eli>   (get-char-code-property ?ί 'decomposition) => (953 769) ; (#x03b9 
#x0301)

    Eli> Do we expand the decomposition property recursively?  It sounds like
    Eli> we don't, but maybe we should.

We donʼt. The following patch allows searching for ι (0x3b9) to match
both ί (0x3af) and ί (1f77). It doesnʼt recurse, but I have no idea if
there are longer chains of decompositions.

It causes

(aref char-fold-table ?ι)

to expand from:
"\\(?:ι[̀́̄̆̈̓̔͂]\\|[ίιϊἰἱὶιῐῑῖ𝛊𝜄𝜾𝝸𝞲]\\)"
to:
"\\(?:ι[̀́̄̆̈̓̔͂]\\|[ΐίιϊἰ-ἷὶίιῐῑῒῖῗ𝛊𝜄𝜾𝝸𝞲]\\)"

where the additions are basically all the variants of IOTA + one or
more diacritical

Even if we donʼt apply this or something like it, itʼs been
educational.

diff --git i/lisp/char-fold.el w/lisp/char-fold.el
index 9d3ea17b41..bf2a4c2484 100644
--- i/lisp/char-fold.el
+++ w/lisp/char-fold.el
@@ -78,6 +78,20 @@
                               (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)
+               (let ((l2-decomp (char-table-range table (car decomp))))
+                 (when (consp l2-decomp)
+                   (when (symbolp (car l2-decomp))
+                     (setq l2-decomp (cdr l2-decomp)))
+                   (if (not (eq (car decomp)
+                                (car l2-decomp)))
+                       (funcall make-decomp-match-char (list (car l2-decomp)) 
char))))
                ;; Do it again, without the non-spacing characters.
                ;; This allows 'a' to match 'ä'.
                (let ((simpler-decomp nil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]