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#16546: C-s vs. whitespace highlighting Date: Mon, 27 Jan 2014 11:21:27 +0200 Organization: JURTA Message-ID: <87vbx53hke.fsf@mail.jurta.org> References: <87eh3wwfug.fsf@jidanni.org> <878uu46uns.fsf@bzg.ath.cx> <87bnyyifgr.fsf@yahoo.fr> <87lhy2idcs.fsf@bzg.ath.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1390814771 23560 80.91.229.3 (27 Jan 2014 09:26:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Jan 2014 09:26:11 +0000 (UTC) Cc: Bastien , 16546@debbugs.gnu.org, Nicolas Richard , Dan Jacobson To: Dani Moncayo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 27 10:26:17 2014 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 1W7iSP-0004zG-Cc for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jan 2014 10:26:17 +0100 Original-Received: from localhost ([::1]:58535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7iSP-0005Zh-0X for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Jan 2014 04:26:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7iSG-0005ZT-Lh for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 04:26:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7iSA-0004ke-Mj for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 04:26:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7iSA-0004ka-Hp for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 04:26:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W7iSA-0008AJ-AO for bug-gnu-emacs@gnu.org; Mon, 27 Jan 2014 04:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Jan 2014 09:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16546 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16546-submit@debbugs.gnu.org id=B16546.139081472431331 (code B ref 16546); Mon, 27 Jan 2014 09:26:02 +0000 Original-Received: (at 16546) by debbugs.gnu.org; 27 Jan 2014 09:25:24 +0000 Original-Received: from localhost ([127.0.0.1]:37360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7iRY-00089H-4A for submit@debbugs.gnu.org; Mon, 27 Jan 2014 04:25:24 -0500 Original-Received: from [69.163.184.122] (port=60095 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7iRV-000897-8e for 16546@debbugs.gnu.org; Mon, 27 Jan 2014 04:25:22 -0500 Original-Received: from localhost.jurta.org (ps18281.dreamhostps.com [69.163.184.122]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 3638536CA0489C; Mon, 27 Jan 2014 01:25:20 -0800 (PST) In-Reply-To: (Dani Moncayo's message of "Mon, 27 Jan 2014 08:50:52 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:84099 Archived-At: > IMO, that behavior would make sense only when the whitespace chars are > entered interactively (i.e. typed on the keyboard), because if the > search string comes from another place (copy&paste, grabbed from the > buffer, ...), I don't think it would be a good idea to temporarily set > `search-whitespace-regexp' to nil. And BTW, that reasoning applies > equally to case-fold-search. I agree that when the user types several spaces in a row explicitly then spaces should be treated as intended by the user. Actually, whitespace search already does this in regexp mode. Relevant lines from regex.c: /* If the spaces are followed by a repetition op, treat them normally. */ if (p1 != pend && (*p1 == '*' || *p1 == '+' || *p1 == '?' || (*p1 == '\\' && p1 + 1 != pend && p1[1] == '{'))) goto normal_char; This means that when the user types ` +' then `search-whitespace-regexp' is ignored. I think the same should be implemented for a non-regexp search as well, so typing ` ' will transform the input to ` +' and ignored. > IOW, if I copy some text "foobar" from one place and > then go to Emacs and do "C-s C-y", I definitely want a "lax" search > wrt whitespace. Indeed. > At least, that behavior should be configurable, IMO. For better configurability I'm using such implementation: (defun search-forward-lax-whitespace (string &optional bound noerror count) (re-search-forward (search-whitespace-regexp (regexp-quote string)) bound noerror count)) (defun search-backward-lax-whitespace (string &optional bound noerror count) (re-search-backward (search-whitespace-regexp (regexp-quote string)) bound noerror count)) (defun re-search-forward-lax-whitespace (regexp &optional bound noerror count) (re-search-forward (search-whitespace-regexp regexp) bound noerror count)) (defun re-search-backward-lax-whitespace (regexp &optional bound noerror count) (re-search-backward (search-whitespace-regexp regexp) bound noerror count)) where in `search-whitespace-regexp' you can do any whitespace handling.