From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#35689: Customizable char-fold Date: Sun, 12 May 2019 22:12:01 +0300 Organization: LINKOV.NET Message-ID: <8736lj3dgm.fsf@mail.linkov.net> References: <87imug8z4i.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="214233"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 35689@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 12 21:29:48 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hPuAO-000tdE-1y for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 May 2019 21:29:48 +0200 Original-Received: from localhost ([127.0.0.1]:46534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPuAN-0003UZ-30 for geb-bug-gnu-emacs@m.gmane.org; Sun, 12 May 2019 15:29:47 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPu9h-000346-RI for bug-gnu-emacs@gnu.org; Sun, 12 May 2019 15:29:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPu9f-0004gz-Po for bug-gnu-emacs@gnu.org; Sun, 12 May 2019 15:29:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hPu9f-0004gk-Ls for bug-gnu-emacs@gnu.org; Sun, 12 May 2019 15:29:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hPu9f-0001jR-GP for bug-gnu-emacs@gnu.org; Sun, 12 May 2019 15:29:03 -0400 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 May 2019 19:29:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35689 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35689-submit@debbugs.gnu.org id=B35689.15576892866541 (code B ref 35689); Sun, 12 May 2019 19:29:03 +0000 Original-Received: (at 35689) by debbugs.gnu.org; 12 May 2019 19:28:06 +0000 Original-Received: from localhost ([127.0.0.1]:43349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPu8k-0001hQ-2T for submit@debbugs.gnu.org; Sun, 12 May 2019 15:28:06 -0400 Original-Received: from ladybird.maple.relay.mailchannels.net ([23.83.214.98]:21554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPu8g-0001gr-3w for 35689@debbugs.gnu.org; Sun, 12 May 2019 15:28:03 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id C1A961257F1 for <35689@debbugs.gnu.org>; Sun, 12 May 2019 19:28:00 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a64.g.dreamhost.com (unknown [100.96.16.23]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 77ECC1249D4 for <35689@debbugs.gnu.org>; Sun, 12 May 2019 19:28:00 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a64.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Sun, 12 May 2019 19:28:00 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Tasty-Hook: 0fefc26e18c1687b_1557689280565_1890213145 X-MC-Loop-Signature: 1557689280565:2894840668 X-MC-Ingress-Time: 1557689280565 Original-Received: from pdx1-sub0-mail-a64.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a64.g.dreamhost.com (Postfix) with ESMTP id 35EB680510 for <35689@debbugs.gnu.org>; Sun, 12 May 2019 12:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=3sRNM7PbeOs5dZ56za24v30VKeU=; b= NUhUURWfG+88qh1qGfOL97Obh9VcGS0L1QLvxmQN4MoSNffmJ2dbdqNxH/G3V8Z1 G8TV/vsp9cJGyOjvtSG0I88I1apW7kq3BLXRCeUbDMX90f/tPydUY5DPiy1eSXqf pMLTPO6H22e79XIsqa6r2BrTs0BYT6DyWJJ6Ov0Hv/4= Original-Received: from mail.jurta.org (m91-129-96-230.cust.tele2.ee [91.129.96.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a64.g.dreamhost.com (Postfix) with ESMTPSA id 325658050F for <35689@debbugs.gnu.org>; Sun, 12 May 2019 12:27:58 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a64 In-Reply-To: <87imug8z4i.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 12 May 2019 00:22:53 +0300") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddrledvgddugedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohhfffgjkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledrleeirddvfedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledrleeirddvfedtpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepfeehieekleesuggvsggsuhhgshdrghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt 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: 209.51.188.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:159152 Archived-At: --=-=-= Content-Type: text/plain > This patch adds long-awaited customization to char-fold.el: I noticed that its compilation fails with: ELC char-fold.elc In toplevel form: char-fold.el:153:31:Error: Symbol's value as variable is void: char-fold-include-base Makefile:296: recipe for target 'char-fold.elc' failed make[2]: *** [char-fold.elc] Error 1 So a new patch added 'eval-and-compile' to all defcustoms: --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=char-fold-defcustom.2.patch Content-Transfer-Encoding: quoted-printable diff --git a/lisp/char-fold.el b/lisp/char-fold.el index e61bc3edc6..a60d49dd8e 100644 --- a/lisp/char-fold.el +++ b/lisp/char-fold.el @@ -24,6 +24,30 @@ =20 (eval-and-compile (put 'char-fold-table 'char-table-extra-slots 1)) =0C +(eval-and-compile (defcustom char-fold-include-base nil + "Include mappings from composite character to base letter." + :type 'boolean + :group 'matching + :version "27.1")) + +(eval-and-compile (defcustom char-fold-include-alist + '((?\" "=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")) + "Additional character mappings to include." + :type '(alist :key-type (character :tag "From") + :value-type (repeat (string :tag "To"))) + :group 'lisp + :version "27.1")) + +(eval-and-compile (defcustom char-fold-exclude-alist nil + "Character mappings to exclude from default setting." + :type '(alist :key-type (character :tag "From") + :value-type (character :tag "To")) + :group 'lisp + :version "27.1")) + +=0C (defconst char-fold-table (eval-when-compile (let ((equiv (make-char-table 'char-fold-table)) @@ -76,7 +109,11 @@ char-fold-table (aref equiv-multi (car decomp)))) (aset equiv (car decomp) (cons (char-to-string char) - (aref equiv (car decomp)))))))) + (aref equiv (car decomp)))) + (when char-fold-include-base + (aset equiv char + (cons (char-to-string (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,13 +135,18 @@ 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))))) =20 + ;; Remove some entries. + (dolist (it char-fold-exclude-alist) + (let ((idx (car it)) + (char (cdr it))) + (when (aref equiv idx) + (aset equiv idx (remove (char-to-string char) (aref equiv id= x)))))) + ;; Convert the lists of characters we compiled into regexps. (map-char-table (lambda (char dec-list) --=-=-=--