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#21164: 25.0.50; char-fold search broken for multi-line searches (sometimes) Date: Sun, 02 Aug 2015 23:40:15 +0300 Organization: LINKOV.NET Message-ID: <87twshqv9s.fsf@mail.linkov.net> References: <87zj2d6keq.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1438548202 29992 80.91.229.3 (2 Aug 2015 20:43:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 2 Aug 2015 20:43:22 +0000 (UTC) Cc: 21164@debbugs.gnu.org To: Dima Kogan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 02 22:43:11 2015 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 1ZM06A-0002pw-5C for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Aug 2015 22:43:10 +0200 Original-Received: from localhost ([::1]:56799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZM069-0006tx-Ge for geb-bug-gnu-emacs@m.gmane.org; Sun, 02 Aug 2015 16:43:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZM065-0006te-P1 for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2015 16:43:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZM062-00071i-I9 for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2015 16:43:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZM062-00071e-FB for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2015 16:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZM062-0007W0-36 for bug-gnu-emacs@gnu.org; Sun, 02 Aug 2015 16:43:02 -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, 02 Aug 2015 20:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21164 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21164-submit@debbugs.gnu.org id=B21164.143854813428831 (code B ref 21164); Sun, 02 Aug 2015 20:43:02 +0000 Original-Received: (at 21164) by debbugs.gnu.org; 2 Aug 2015 20:42:14 +0000 Original-Received: from localhost ([127.0.0.1]:37519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM05F-0007Ux-IU for submit@debbugs.gnu.org; Sun, 02 Aug 2015 16:42:13 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:51051 helo=homiemail-a13.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZM05C-0007Uf-FL for 21164@debbugs.gnu.org; Sun, 02 Aug 2015 16:42:10 -0400 Original-Received: from homiemail-a13.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTP id 01EAF33406F; Sun, 2 Aug 2015 13:42:10 -0700 (PDT) Original-Received: from localhost.linkov.net (m83-191-198-229.cust.tele2.ee [83.191.198.229]) (Authenticated sender: jurta@jurta.org) by homiemail-a13.g.dreamhost.com (Postfix) with ESMTPA id EFCE933406C; Sun, 2 Aug 2015 13:42:08 -0700 (PDT) In-Reply-To: <87zj2d6keq.fsf@secretsauce.net> (Dima Kogan's message of "Thu, 30 Jul 2015 21:06:05 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.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:105283 Archived-At: > Hi. I'm using a very recent emacs built from the git HEAD. Sometime in > the recent past the default C-s behavior was changed to include > char-folding by default. There's a bug here. Suppose I have a buffer > containing the following C source. > > ---------------------------------------------------- > int a(void) > { > for(unsigned long x = 0; > x < 10; > x += 2) > { > nvm_flash_erase_app_page( x ); > } > } > > int b(void) > { > for(unsigned long x = 0; > x < 10; > x += 2) > { > } > } > ---------------------------------------------------- > > > Note that the two functions are identical. I place the point at the > start of one of the 'for' statements, then C-s to enter char-folding > isearch, then C-w to grab some amount of text to search for. While I'm > grabbing text that's still on the 'for' line, isearch sees the other > match, highlights it, and I can jump to it by hitting C-s. However, if I > hit C-w enough times to go to the next line, the other match is no > longer seen. This resolves when I turn off char-folding. Thank you for the bug report. This can be fixed by a small patch: diff --git a/lisp/character-fold.el b/lisp/character-fold.el index bf5ae59..db77845 100644 --- a/lisp/character-fold.el +++ b/lisp/character-fold.el @@ -123,7 +123,7 @@ (defun character-fold-to-regexp (string &optional lax) (apply #'concat (mapcar (lambda (c) (let ((out (or (aref character-fold-table c) (regexp-quote (string c))))) - (if (and lax (memq c '(?\s ?\t ?\r ?\n ))) + (if (memq c '(?\s ?\t ?\r ?\n )) (concat out "+") out))) string)) Later we could also see how to handle both lax-at-the-end-of-the-search-string and lax-a-sequence-of-whitespace-chars. Maybe something like: diff --git a/lisp/isearch.el b/lisp/isearch.el index 8d4bf24..74b7e56 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2613,7 +2613,11 @@ (defun isearch-search-fun-default () (length (isearch--state-string (car isearch-cmds)))))))) (funcall - (if isearch-forward #'re-search-forward #'re-search-backward) + (if (and isearch-lax-whitespace search-whitespace-regexp) + (if isearch-forward + 're-search-forward-lax-whitespace + 're-search-backward-lax-whitespace) + (if isearch-forward #'re-search-forward #'re-search-backward)) (if (functionp isearch-word) (funcall isearch-word string lax) (word-search-regexp string lax))