From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#52394: 27.2; Isearch with char folding enabled =?UTF-8?Q?doesn=E2=80=99t?= match equivalent strings Date: Sun, 12 Dec 2021 19:19:14 +0200 Organization: LINKOV.NET Message-ID: <86pmq1q5it.fsf@mail.linkov.net> References: <86ilvwkidx.fsf@mail.linkov.net> <86czm2ncfe.fsf@mail.linkov.net> <864k7elw3m.fsf@mail.linkov.net> <864k7eb7kj.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31067"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 52394@debbugs.gnu.org To: Andrea Greselin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 12 18:37:04 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwSmW-0007uc-4I for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 18:37:04 +0100 Original-Received: from localhost ([::1]:54552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwSmU-0003E0-Rg for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 12:37:02 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwSla-0003BO-IE for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 12:36:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41476) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwSlW-00034E-NM for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 12:36:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwSlW-0002LP-Kx for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 12:36:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Dec 2021 17:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52394 X-GNU-PR-Package: emacs Original-Received: via spool by 52394-submit@debbugs.gnu.org id=B52394.16393305508971 (code B ref 52394); Sun, 12 Dec 2021 17:36:02 +0000 Original-Received: (at 52394) by debbugs.gnu.org; 12 Dec 2021 17:35:50 +0000 Original-Received: from localhost ([127.0.0.1]:53018 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwSlK-0002Kc-12 for submit@debbugs.gnu.org; Sun, 12 Dec 2021 12:35:50 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:49473) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwSlH-0002KM-Kj for 52394@debbugs.gnu.org; Sun, 12 Dec 2021 12:35:48 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 30CE2240002; Sun, 12 Dec 2021 17:35:39 +0000 (UTC) In-Reply-To: (Andrea Greselin's message of "Sun, 12 Dec 2021 10:31:27 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222237 Archived-At: --=-=-= Content-Type: text/plain > Even better, yes. In addition to simplifying changing the default, > something like that would make it easy to create different levels of > folding and switch between them (by writing commands that add or > remove certain characters from the list). Thanks for the suggestion, This is implemented by the following patch: --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=char-fold-override.patch Content-Transfer-Encoding: 8bit diff --git a/lisp/char-fold.el b/lisp/char-fold.el index e3ab7d5b64..12c9d2d4b1 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -26,6 +26,7 @@ (eval-and-compile (put 'char-fold-table 'char-table-extra-slots 1) + (defconst char-fold--default-override nil) (defconst char-fold--default-include '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»") (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›") @@ -40,7 +41,8 @@ )) (defconst char-fold--default-symmetric nil) (defvar char-fold--previous - (list char-fold--default-include + (list char-fold--default-override + char-fold--default-include char-fold--default-exclude char-fold--default-symmetric))) @@ -67,6 +69,8 @@ ;; - A single char of the decomp might be allowed to match the ;; character. ;; Some examples in the comments below. + (unless (or (bound-and-true-p char-fold-override) + char-fold--default-override) (map-char-table (lambda (char decomp) (when (consp decomp) @@ -135,7 +139,7 @@ (aset equiv (car simpler-decomp) (cons (apply #'string decomp) (aref equiv (car simpler-decomp))))))))))) - table) + table)) ;; Add some entries to default decomposition (dolist (it (or (bound-and-true-p char-fold-include) @@ -232,7 +236,9 @@ char-fold-table (defun char-fold-update-table () "Update char-fold-table only when one of the options changes its value." - (let ((new (list (or (bound-and-true-p char-fold-include) + (let ((new (list (or (bound-and-true-p char-fold-override) + char-fold--default-override) + (or (bound-and-true-p char-fold-include) char-fold--default-include) (or (bound-and-true-p char-fold-exclude) char-fold--default-exclude) @@ -242,6 +248,22 @@ char-fold-update-table (setq char-fold-table (char-fold--make-table) char-fold--previous new)))) +(defcustom char-fold-override char-fold--default-override + "Non-nil means to override all default folding characters. +When nil, the equivalence table is populated with the default set +of equivalent chars, and you can remove unneeded characters using +`char-fold-exclude', and add own characters using `char-fold-include'. +But when this variable is customized to non-nil, you start with +an empty table where you can add only own characters +using `char-fold-include'." + :type 'boolean + :initialize #'custom-initialize-default + :set (lambda (sym val) + (custom-set-default sym val) + (char-fold-update-table)) + :group 'isearch + :version "29.1") + (defcustom char-fold-include char-fold--default-include "Additional character foldings to include. Each entry is a list of a character and the strings that fold into it." --=-=-=--