unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: emacs-devel@gnu.org
Subject: ignoring combining diacritics in isearch
Date: Wed, 23 Nov 2022 18:27:25 +0100	[thread overview]
Message-ID: <878rk1fuo2.fsf@gmail.com> (raw)

Over on Stack Overflow, someone has been trying to get char-folded
isearch working for Arabic, and has been having some issues because
char-folding only works for equivalent characters, not base characters
followed by combining characters. So eg searching for 'ee' when the
buffer contains

    éé

(thatʼs 'e' followed by COMBINING ACUTE ACCENT) fails.

The following patch fixes that, but itʼs a bit of a sledgehammer (the
"\\c^*" bit probably needs to be configurable, because there are
diacritic-like codepoints in Arabic that are not combining, such as
U+0640 ARABIC TATWEEL)

diff --git c/lisp/char-fold.el i/lisp/char-fold.el
index 43e3cd45ec..8e9fdd7f37 100644
--- c/lisp/char-fold.el
+++ i/lisp/char-fold.el
@@ -209,7 +209,11 @@
         ;; is used by `describe-char-fold-equivalences'.
         (map-char-table
          (lambda (char decomp-list)
-           (let ((re (regexp-opt (cons (char-to-string char) decomp-list))))
+           (let ((re
+                  (concat "\\(?:"
+                          (string-join (cons (char-to-string char) decomp-list)
+                                       "\\c^*\\|")
+                          "\\c^*\\)")))
              (aset equiv char re)))
          equiv))
       equiv)))

Thoughts?

Robert
-- 



             reply	other threads:[~2022-11-23 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 17:27 Robert Pluim [this message]
2022-11-23 17:45 ` ignoring combining diacritics in isearch Juri Linkov
2022-11-23 18:02 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=878rk1fuo2.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).