From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Interpretation of a space in regexp isearch? Date: Wed, 29 Aug 2012 01:54:18 +0300 Organization: JURTA Message-ID: <87k3wihbl1.fsf@mail.jurta.org> References: <502B2845.9070200@yandex.ru> <878vdgiv2d.fsf@gnu.org> <87r4qu8ffq.fsf@gnu.org> <87haro6v5y.fsf@gnu.org> <87k3wjto4o.fsf@mail.jurta.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1346196864 18253 80.91.229.3 (28 Aug 2012 23:34:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Aug 2012 23:34:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 29 01:34:25 2012 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 1T6VId-00083H-Vc for ged-emacs-devel@m.gmane.org; Wed, 29 Aug 2012 01:34:24 +0200 Original-Received: from localhost ([::1]:50453 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6V5z-0002jk-VO for ged-emacs-devel@m.gmane.org; Tue, 28 Aug 2012 19:21:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6V5w-0002io-Pe for emacs-devel@gnu.org; Tue, 28 Aug 2012 19:21:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T6V5v-0004oI-O9 for emacs-devel@gnu.org; Tue, 28 Aug 2012 19:21:16 -0400 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:38269 helo=ps18281.dreamhostps.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6V5v-0004nH-Hs for emacs-devel@gnu.org; Tue, 28 Aug 2012 19:21:15 -0400 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 1AE5D451CB37; Tue, 28 Aug 2012 16:21:12 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 28 Aug 2012 08:53:35 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 69.163.218.105 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:152877 Archived-At: > I have other things to do, so I haven't participated in this thread, > but FWIW, I think that search-whitespace-regexp is not something that > should be used by default. Ignoring whitespace in isearch is a very useful feature. But I agree that its current implementation is far from optimal. It would be better to reimplement it in isearch exactly the same way as `isearch-word' is implemented because these two are similar features. A new `isearch-whitespace' toggled by `M-s SPC' could construct a regexp like in `word-search-regexp' and search it with `re-search-forward' in `isearch-search-fun-default'. This will provide flexibility to solve related problems. To make this feature less "magic" and surprising to users, it could reveal a constructed regexp after switching from ordinary isearch mode to regexp mode. As well as after switching from word mode to regexp mode could also reveal the regexp used to search words ignoring punctuation. Another variant to implement `isearch-toggle-whitespace' is like `isearch-toggle-case-fold' that changes the value of the internal variable `case-fold-search' effective to both regexp and non-regexp searches. But I don't know how difficult is to modify the search engine to ignore whitespace the same way as it ignores case using translation tables. Regarding the need to quote literal spaces in non-regexp search, one example of possible solution is HTML that uses "nobr" for essential whitespace that should not be ignored. Doing the same in isearch for `C-q SPC' would insert "no-break space" to the search string. Then repeating a non-regexp search from the search ring will correctly interpret it as a literal space (as opposed to the normal space character interpreted as whitespace pattern).