From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#22147: Obsolete search-forward-lax-whitespace Date: Wed, 18 May 2016 22:34:05 +0300 Organization: LINKOV.NET Message-ID: <87mvnngnyq.fsf@mail.linkov.net> References: <87wpsk7dcs.fsf@mail.linkov.net> <87d1ubz3w9.fsf@mail.linkov.net> <87r3ipoofk.fsf@mail.linkov.net> <87zixcblno.fsf@mail.linkov.net> <874mfjchp1.fsf@mail.linkov.net> <87r3d4z7uf.fsf@mail.linkov.net> <8ec0f5d4-a500-42c1-bab8-eaba00f0915c@default> <87shxjjb0h.fsf@mail.linkov.net> <8e655300-1a72-4df6-87cf-91fd006cb3d7@default> <8737pgwgiu.fsf@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1463600430 25998 80.91.229.3 (18 May 2016 19:40:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 May 2016 19:40:30 +0000 (UTC) Cc: 22147@debbugs.gnu.org To: Artur Malabarba Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 18 21:40:19 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b37KM-0000R5-N2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 May 2016 21:40:18 +0200 Original-Received: from localhost ([::1]:46829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b37KI-0003li-Nn for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 May 2016 15:40:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b37K7-0003gd-QS for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 15:40:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b37K6-0005Gq-D6 for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 15:40:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b37K6-0005Gm-9Q for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 15:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1b37K5-0000QG-Vj for bug-gnu-emacs@gnu.org; Wed, 18 May 2016 15:40:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 May 2016 19:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22147 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22147-submit@debbugs.gnu.org id=B22147.14636003921603 (code B ref 22147); Wed, 18 May 2016 19:40:01 +0000 Original-Received: (at 22147) by debbugs.gnu.org; 18 May 2016 19:39:52 +0000 Original-Received: from localhost ([127.0.0.1]:57293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b37Jw-0000Pn-Jt for submit@debbugs.gnu.org; Wed, 18 May 2016 15:39:52 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:42607 helo=homiemail-a11.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b37Jv-0000Pf-1S for 22147@debbugs.gnu.org; Wed, 18 May 2016 15:39:51 -0400 Original-Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id B66BE6E07E; Wed, 18 May 2016 12:39:47 -0700 (PDT) Original-Received: from localhost.linkov.net (85.253.59.205.cable.starman.ee [85.253.59.205]) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPA id A7F8A6E079; Wed, 18 May 2016 12:39:46 -0700 (PDT) In-Reply-To: (Artur Malabarba's message of "Wed, 18 May 2016 03:00:35 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:118414 Archived-At: > I'm of the opinion that we should avoid over thinking this feature for = the > first release. And I'm also of the opinion that complicated custom-vars > (like alists of alists) are less helpful than simple custom vars. So I'= d > strongly prefer if we don't turn this variable into something more > complicated. I agree that we are better off starting with simpler customization, and then gradually adding more layers later when needed. I wonder why you removed defvar mappings from your initial patches with =E2=80=98isearch-groups-alist=E2=80=99 and =E2=80=98isearch--charact= er-fold-extras=E2=80=99 (a similar variable is also presented in Drew's =E2=80=98char-fold-ad-hoc= =E2=80=99). Now I tried to reintroduce these lists with different names: =E2=80=98char-fold-include-alist=E2=80=99 with a list to add to default m= appings and =E2=80=98char-fold-exclude-alist=E2=80=99 with a list to remove from defa= ult mappings taking into account all opinions expressed on emacs-devel for the default values: diff --git a/lisp/char-fold.el b/lisp/char-fold.el index 68bea29..68d1eb0 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -22,10 +22,68 @@ =20 ;;; Code: =20 -(eval-and-compile (put 'char-fold-table 'char-table-extra-slots 1)) +(put 'char-fold-table 'char-table-extra-slots 1) =0C -(defconst char-fold-table - (eval-when-compile +(defcustom char-fold-include-alist + (append + '((?\" "=EF=BC=82" "=E2=80=9C" "=E2=80=9D" "=E2=80=9D" "=E2=80=9E" "=E2= =B9=82" "=E3=80=9E" "=E2=80=9F" "=E2=80=9F" "=E2=9D=9E" "=E2=9D=9D" "=E2=9D= =A0" "=E2=80=9C" "=E2=80=9E" "=E3=80=9D" "=E3=80=9F" "=F0=9F=99=B7" "=F0=9F= =99=B6" "=F0=9F=99=B8" "=C2=AB" "=C2=BB") + (?' "=E2=9D=9F" "=E2=9D=9B" "=E2=9D=9C" "=E2=80=98" "=E2=80=99" "=E2= =80=9A" "=E2=80=9B" "=E2=80=9A" "=F3=A0=80=A2" "=E2=9D=AE" "=E2=9D=AF" "=E2= =80=B9" "=E2=80=BA") + (?` "=E2=9D=9B" "=E2=80=98" "=E2=80=9B" "=F3=A0=80=A2" "=E2=9D=AE" = "=E2=80=B9") + (?=E2=86=92 "->") (?=E2=87=92 "=3D>") + (?1 "=E2=92=88") (?2 "=E2=92=89") (?3 "=E2=92=8A") (?4 "=E2=92=8B")= (?5 "=E2=92=8C") (?6 "=E2=92=8D") (?7 "=E2=92=8E") (?8 "=E2=92=8F") (?9 = "=E2=92=90") (?0 "=F0=9F=84=80") + ) + (unless (string-match-p "^\\(?:da\\|n[obn]\\)" (getenv "LANG")) + '((?o "=C3=B8") + (?O "=C3=98"))) + (unless (string-match-p "^pl" (getenv "LANG")) + '((?l "=C5=82") + (?L "=C5=81"))) + (unless (string-match-p "^de" (getenv "LANG")) + '((?=C3=9F "ss"))) + ) + "Ad hoc character foldings. +Each entry is a list of a character and the strings that fold into it." + :set (lambda (symbol value) + (custom-set-default symbol value) + (with-no-warnings + (setq char-fold-table (make-char-fold-table)))) + :initialize 'custom-initialize-default + :type '(repeat (cons + (character :tag "Fold to character") + (repeat (string :tag "Fold from string")))) + :version "25.1" + :group 'isearch) + +(defcustom char-fold-exclude-alist + (append + (when (string-match-p "^es" (getenv "LANG")) + '((?n "=C3=B1") + (?N "=C3=91"))) + (when (string-match-p "^\\(?:sv\\|fi\\|et\\)" (getenv "LANG")) + '((?a "=C3=A4") + (?A "=C3=84") + (?o "=C3=B6") + (?O "=C3=96"))) + (when (string-match-p "^\\(?:sv\\|da\\|n[obn]\\)" (getenv "LANG")) + '((?a "=C3=A5") + (?A "=C3=85"))) + (when (string-match-p "^ru" (getenv "LANG")) + '((?=D0=B8 "=D0=B9") + (?=D0=98 "=D0=99")))) + "Character foldings to remove from default mappings. +Each entry is a list of a character and the strings that unfold from it.= " + :set (lambda (symbol value) + (custom-set-default symbol value) + (with-no-warnings + (setq char-fold-table (make-char-fold-table)))) + :initialize 'custom-initialize-default + :type '(repeat (cons + (character :tag "Unfold to character") + (repeat (string :tag "Unfold from string")))) + :version "25.1" + :group 'isearch) + +(defun make-char-fold-table () (let ((equiv (make-char-table 'char-fold-table)) (equiv-multi (make-char-table 'char-fold-table)) (table (unicode-property-table-internal 'decomposition))) @@ -58,9 +116,11 @@ char-fold-table ;; If there's no formatting tag, ensure that char matches ;; its decomp exactly. This is because we want '=C3=A4' = to ;; match 'a=CC=88', but we don't want '=C2=B9' to match '= 1'. + (unless (and (assq char char-fold-exclude-alist) + (member (apply #'string decomp) (assq char cha= r-fold-exclude-alist))) (aset equiv char (cons (apply #'string decomp) - (aref equiv char)))) + (aref equiv char))))) =20 ;; Allow the entire decomp to match char. If decomp has ;; multiple characters, this is done by adding an entry @@ -74,9 +134,11 @@ char-fold-table (cons (cons (apply #'string (cdr decomp)= ) (regexp-quote (string char))= ) (aref equiv-multi (car decomp)))) + (unless (and (assq (car decomp) char-fold-exclude-= alist) + (member (char-to-string char) (assq (= car decomp) char-fold-exclude-alist))) (aset equiv (car decomp) (cons (char-to-string char) - (aref equiv (car decomp)))))))) + (aref equiv (car decomp))))))))) (funcall make-decomp-match-char decomp char) ;; Do it again, without the non-spacing characters. ;; This allows 'a' to match '=C3=A4'. @@ -98,9 +160,7 @@ char-fold-table table) =20 ;; Add some manual entries. - (dolist (it '((?\" "=EF=BC=82" "=E2=80=9C" "=E2=80=9D" "=E2=80=9D"= "=E2=80=9E" "=E2=B9=82" "=E3=80=9E" "=E2=80=9F" "=E2=80=9F" "=E2=9D=9E" = "=E2=9D=9D" "=E2=9D=A0" "=E2=80=9C" "=E2=80=9E" "=E3=80=9D" "=E3=80=9F" "= =F0=9F=99=B7" "=F0=9F=99=B6" "=F0=9F=99=B8" "=C2=AB" "=C2=BB") - (?' "=E2=9D=9F" "=E2=9D=9B" "=E2=9D=9C" "=E2=80=98" = "=E2=80=99" "=E2=80=9A" "=E2=80=9B" "=E2=80=9A" "=F3=A0=80=A2" "=E2=9D=AE= " "=E2=9D=AF" "=E2=80=B9" "=E2=80=BA") - (?` "=E2=9D=9B" "=E2=80=98" "=E2=80=9B" "=F3=A0=80=A2= " "=E2=9D=AE" "=E2=80=B9"))) + (dolist (it char-fold-include-alist) (let ((idx (car it)) (chars (cdr it))) (aset equiv idx (append chars (aref equiv idx))))) @@ -114,6 +174,9 @@ char-fold-table (aset equiv char re)))) equiv) equiv)) + +(defvar char-fold-table + (make-char-fold-table) "Used for folding characters of the same group during search. This is a char-table with the `char-fold-table' subtype. =20