From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: ASCII-folded search [was: Re: Upcoming loss of usability ...] Date: Wed, 24 Jun 2015 09:03:48 +0100 Message-ID: References: <20150615142237.GA3517@acm.fritz.box> <87y4jkhqh5.fsf@uwakimon.sk.tsukuba.ac.jp> <557F3C22.4060909@cs.ucla.edu> <5580D356.4050708@cs.ucla.edu> <87si9qonxb.fsf@gnu.org> <87ioamz8if.fsf@petton.fr> <32013464-2300-46c6-ba46-4a3c36bfee5d@default> <87twu62nnt.fsf@mbork.pl> <87oakdfwim.fsf@uwakimon.sk.tsukuba.ac.jp> <83wpz1lh7c.fsf@gnu.org> <83oakdl7yj.fsf@gnu.org> <83ioall3x5.fsf@gnu.org> <87h9pzxtyi.fsf@mail.linkov.net> <87k2uudoqr.fsf@mail.linkov.net> Reply-To: bruce.connor.am@gmail.com 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 1435133045 30048 80.91.229.3 (24 Jun 2015 08:04:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Jun 2015 08:04:05 +0000 (UTC) Cc: "Stephen J. Turnbull" , Eli Zaretskii , Stefan Monnier , emacs-devel To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 24 10:04:00 2015 Return-path: Envelope-to: ged-emacs-devel@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 1Z7ff5-0003QE-Ns for ged-emacs-devel@m.gmane.org; Wed, 24 Jun 2015 10:03:59 +0200 Original-Received: from localhost ([::1]:49209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7ff5-0005tO-1t for ged-emacs-devel@m.gmane.org; Wed, 24 Jun 2015 04:03:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7ff1-0005tI-0G for emacs-devel@gnu.org; Wed, 24 Jun 2015 04:03:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7fez-0004XS-Sa for emacs-devel@gnu.org; Wed, 24 Jun 2015 04:03:54 -0400 Original-Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:35159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7fev-0004T4-OK; Wed, 24 Jun 2015 04:03:49 -0400 Original-Received: by lagi2 with SMTP id i2so21153774lag.2; Wed, 24 Jun 2015 01:03:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=xq3ZBVmFikT1heuZT5yJXA1MKNTvh7r1VQzOb+lqjds=; b=LA/9/Cj7k6MVpbUhdJZRbHtoxSjHthATvusFTE/0HZ2/6iczZwcV/Ob6O3eykWQFXP lbEJa6fAOo3L5fUksWpo47RNhmvbyNJPL4k2lP1N4ycuKqxqyhuhptM6vZsa/PNu6l9R 8gcBoqwjmxFrhr/4/1nRDRyxqHVkcrcrVwSiu20emJFGXGEGhYcdHfgk6Lb0aIwStVGf fWqtRxmRrDCc3vH6tufRPbRx1oZA5yYTevh3JPCeFl0XggGXpDP3dPKS5MlvHWgP2XAW LYJPx6kWWt8AxpfS4Ln5Kal0pUEzXozMpr7w/Vd3UALupktn2TQpscXnUoin0dyJglVd upUA== X-Received: by 10.152.44.166 with SMTP id f6mr38948260lam.86.1435133028999; Wed, 24 Jun 2015 01:03:48 -0700 (PDT) Original-Received: by 10.25.214.133 with HTTP; Wed, 24 Jun 2015 01:03:48 -0700 (PDT) In-Reply-To: <87k2uudoqr.fsf@mail.linkov.net> X-Google-Sender-Auth: nWpJaF13EO-fneTrRzq_X9WC990 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187464 Archived-At: 2015-06-23 23:49 GMT+01:00 Juri Linkov >>> Have you found a way to combine char-folding with case-folding? >> >> Yes. This particular patch uses regexps, so it works independently of >> case-fold-search. That is, if case-fold-search is on, then you will get >> case folding in addition to this. >> >>> (in https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00407.htm= l >>> another hard problem was char-folding with a combining character.) >> >> That works too. "a" matches both "=C3=A1" (the letter) and "a=CC=81" (a = letter with a >> combining character). > It would be easy also to allow "a=CC=81" match "a" (by normalizing the > original search string It's easy for things like =E2=80=9C=E2=93=90=E2=80=9D or =E2=80=9C=C3=A1=E2= =80=9D, which are single characters, normalizing a combination of multiple characters (like =E2=80=9Ca=CC=81=E2= =80=9D) can get a little complicated. But then, I don't think we want to do either. > like "A" matches "a" in case insensitive mode), It doesn't for me. If I type C-s A, it only matches the capital =E2=80=9CA= =E2=80=9D. Whereas if I type C-s a it matches both =E2=80=9Ca=E2=80=9D and =E2=80=9CA= =E2=80=9D. The same happens during query-replace and other commands. That's a feature, not a flaw. If the user explicitly typed out =E2=80=9C=C3=A1=E2=80=9D, they probably do= n't want to match =E2=80=9Ca=E2=80=9D (or they would have just typed =E2=80=9Ca=E2=80= =9D in the first place). > Regarding the usage of the regexp, please consider a simpler way > to use your character-folding regexp that would be just: > > (define-key isearch-mode-map "\M-sd" 'isearch-toggle-character-fold) > (defun isearch-toggle-character-fold () > (interactive) > (setq isearch-word (unless (eq isearch-word 'isearch--character-folded-= regexp) > 'isearch--character-folded-regexp)) > (if isearch-word (setq isearch-regexp nil)) > (setq isearch-success t isearch-adjusted t) > (isearch-update)) > (put 'isearch--character-folded-regexp 'isearch-message-prefix "char-fold= ") Thanks, I was meaning to look into how to make it toggleable. Will that snippet make it ON by default? If not, how could I do that?