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: Tue, 23 Jun 2015 18:20:41 +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> <83si9ifk4p.fsf@gnu.org> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1435080069 4958 80.91.229.3 (23 Jun 2015 17:21:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 23 Jun 2015 17:21:09 +0000 (UTC) Cc: Stephen Turnbull , Stefan Monnier , emacs-devel To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 23 19:21:08 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 1Z7Rsi-0002T7-2P for ged-emacs-devel@m.gmane.org; Tue, 23 Jun 2015 19:21:08 +0200 Original-Received: from localhost ([::1]:46614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7Rsh-0004eF-Cp for ged-emacs-devel@m.gmane.org; Tue, 23 Jun 2015 13:21:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7RsL-0004Sv-4Z for emacs-devel@gnu.org; Tue, 23 Jun 2015 13:20:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7RsK-0000xL-31 for emacs-devel@gnu.org; Tue, 23 Jun 2015 13:20:45 -0400 Original-Received: from mail-lb0-x22f.google.com ([2a00:1450:4010:c04::22f]:35293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7RsI-0000wJ-Js; Tue, 23 Jun 2015 13:20:42 -0400 Original-Received: by lbbwc1 with SMTP id wc1so11079019lbb.2; Tue, 23 Jun 2015 10:20:41 -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; bh=1PJJvGBRTjLDDqLgfIlQBBB7eFaEa06N4lO9v0TQSV0=; b=t0vQstV7sFNRx1fDC31XteNlUeoM2CE5+m19Kti5wIT1Dd5O1BPorDMD/opsvgku6z CHzsYsr77GvQDPwLyqC/Z8TG/RqB1D5bd7KRZdwWZNWTUPinLCmtCKP+SvaeQJ+iFeJI hWxjRUCgNAZSZtJ1OUMOZDvf9nGVZoUGKCsgRBMif67djNiTWeUHG1rfrGCQw8bnIe/a zJFBZ0vxavTdRswLpAc37RcsIsXWe2jv1YmOE+3x0k7yEJqa2ATqHx7stGdOjMjj9+Dq fRF88y4/c6TPFyxcl0aOmgGXQRl6PCkyFdZgzova2kLSHG1N1YjPImJI/cdtf4p7C4kb fauA== X-Received: by 10.112.204.6 with SMTP id ku6mr36077888lbc.73.1435080041917; Tue, 23 Jun 2015 10:20:41 -0700 (PDT) Original-Received: by 10.25.214.133 with HTTP; Tue, 23 Jun 2015 10:20:41 -0700 (PDT) In-Reply-To: <83si9ifk4p.fsf@gnu.org> X-Google-Sender-Auth: nFtps3ab4OEJCxJOOq-wuhnH0m0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22f 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:187431 Archived-At: > Yes. But I'd still want to know what would it take to make this > applicable to other types of search. Essentially, this patch does two things. 1. It provides a function that takes a string S and returns a regexp that matches anything that folds into S. This is why it only works on non-regexp searching, because it takes a regular string and turns it into a regexp. But other than that, it's generic (it's not specific to isearch). 2. It also uses this function to implement character-fold matching in `isearch' and in `query-replace'. In order to use this character-folding with other searches, these need to call the conversion function too. For instance, to get this character folding behavior with `search-forward', instead of writing (search-forward STRING) I would instead write (conditional on a variable being non-nil) (search-forward-regexp (isearch--character-folded-regexp STRING)) But I can't do that directly inside search-forward, because that's a c function. So it needs to be done in the functions that call search-forward. I was aware of isearch and query-replace, but there's no reason it won't work on others.