all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: search-default-mode char-fold-to-regexp and Greek Extended block characters
Date: Sun, 21 Jul 2019 13:03:37 +0200	[thread overview]
Message-ID: <m2blxnodiu.fsf@gmail.com> (raw)
In-Reply-To: <83wogduc41.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 19 Jul 2019 21:13:02 +0300")

>>>>> On Fri, 19 Jul 2019 21:13:02 +0300, Eli Zaretskii <eliz@gnu.org> 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	other threads:[~2019-07-21 11:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 14:18 search-default-mode char-fold-to-regexp and Greek Extended block characters Robert Pluim
2019-07-19 14:37 ` Eli Zaretskii
2019-07-19 16:03   ` Robert Pluim
2019-07-19 18:13     ` Eli Zaretskii
2019-07-21 11:03       ` Robert Pluim [this message]
2019-07-22 18:39         ` Robert Pluim
2019-07-23 14:57           ` Eli Zaretskii
2019-07-23 17:43             ` Robert Pluim
2019-07-23 20:29               ` Juri Linkov
2019-07-24  7:56                 ` Robert Pluim
2019-07-24  7:59                   ` Robert Pluim
2019-07-24  9:04                 ` Robert Pluim
2019-07-24 23:12                   ` Juri Linkov
2019-07-25  0:18                     ` Basil L. Contovounesios
2019-07-25 18:40                       ` Juri Linkov
2019-07-25 20:44                         ` search-default-mode char-fold-to-regexp and Greek Extended block characters, " Robert Pluim
2019-07-25 21:35                           ` Juri Linkov
2019-07-26 11:09                             ` Robert Pluim
2019-07-26 18:38                               ` Juri Linkov
2019-07-29  8:32                                 ` Robert Pluim
2019-07-29 18:09                                   ` Juri Linkov
2019-07-30  8:09                                     ` Robert Pluim
2019-07-30 10:15                                       ` Eli Zaretskii
2019-07-25  2:36                     ` Eli Zaretskii
2019-07-25  8:59                       ` Robert Pluim
2019-07-25 12:53                         ` Eli Zaretskii
2019-07-25  8:46                     ` Robert Pluim
2019-07-25 18:46                       ` Juri Linkov
2019-07-26  6:04                         ` Eli Zaretskii
2019-07-26 18:40                           ` Juri Linkov
2019-07-26 19:13                             ` Eli Zaretskii
2019-07-19 18:53 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2blxnodiu.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.