unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: Chong Yidong <cyd@gnu.org>, emacs-devel@gnu.org
Subject: Re: Interpretation of a space in regexp isearch?
Date: Tue, 28 Aug 2012 11:28:44 +0300	[thread overview]
Message-ID: <87ligzto77.fsf@mail.jurta.org> (raw)
In-Reply-To: <CAH8Pv0joxTnmW=F6HPLv-nmaVJ_abCHJqfEJjBbnzrZUCYz=Rg@mail.gmail.com> (Dani Moncayo's message of "Sun, 26 Aug 2012 19:31:41 +0200")

> 1. Info mode has its own variable `Info-search-whitespace-regexp'.
> Why is it necessary?  I guess there's a reason (which I don't know by
> now)

`Info-search-whitespace-regexp' is used in the regexp-based `Info-search'.
Its default value is the same as for `search-whitespace-regexp'
(actually it could inherit the default value directly from the value of
`search-whitespace-regexp').

> so it seems that your change should also affect to this variable.

Yes, these changes affect this variable.  The condition that checks for
`isearch-regexp' should be removed from `Info-search' like in the patch
below (could be installed after resolving other problems).

> 2. Why don't you include \n and \r by default in the regexp?  IMO
> that'd be TRT for most users.

The default value of `search-whitespace-regexp' is "\\s-+"
that means it matches whitespace including \n and \r by default.
However, some modes override this default whitespace syntax
where newlines are not whitespace.  For example, in Lisp
a newline ends a comment.  But currently you can't search
in comments without regard to line breaks anyway.
To implement this, `search-whitespace-regexp' should also
ignore the semicolon that starts a comment.

> 3.  Why should this feature be limited to _incremental_ searches?  I
> don't think it should.  The documentation states this limitation (see
> [1][2][3]) but according to the tests I've done, non-incremental
> searches also take `search-whitespace-regexp' into account.

By the term "non-incremental searches" do you mean
`M-x nonincremental-search-forward RET' or `C-s RET'?

PS: The patch for info.el:

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-08-25 20:00:40 +0000
+++ lisp/info.el	2012-08-28 08:27:44 +0000
@@ -328,7 +328,7 @@ (defcustom Info-breadcrumbs-depth 4
   :type 'integer
   :group 'info)
 
-(defcustom Info-search-whitespace-regexp "\\s-+"
+(defcustom Info-search-whitespace-regexp search-whitespace-regexp
   "If non-nil, regular expression to match a sequence of whitespace chars.
 This applies to Info search for regular expressions.
 You might want to use something like \"[ \\t\\r\\n]+\" instead.
@@ -1892,9 +1892,7 @@ (defun Info-search (regexp &optional bou
 		      (or (null found)
 			  (not (run-hook-with-args-until-failure
 				'isearch-filter-predicates beg-found found))))
-	    (let ((search-spaces-regexp
-		   (if (or (not isearch-mode) isearch-regexp)
-		       Info-search-whitespace-regexp)))
+	    (let ((search-spaces-regexp Info-search-whitespace-regexp))
 	      (if (if backward
 		      (re-search-backward regexp bound t)
 		    (re-search-forward regexp bound t))
@@ -1914,9 +1912,7 @@ (defun Info-search (regexp &optional bou
 	  (if (null Info-current-subfile)
 	      (if isearch-mode
 		  (signal 'search-failed (list regexp "at the end of manual"))
-		(let ((search-spaces-regexp
-		       (if (or (not isearch-mode) isearch-regexp)
-			   Info-search-whitespace-regexp)))
+		(let ((search-spaces-regexp Info-search-whitespace-regexp))
 		  (if backward
 		      (re-search-backward regexp)
 		    (re-search-forward regexp))))
@@ -1975,9 +1971,7 @@ (defun Info-search (regexp &optional bou
 			    (or (null found)
 				(not (run-hook-with-args-until-failure
 				      'isearch-filter-predicates beg-found found))))
-		  (let ((search-spaces-regexp
-			 (if (or (not isearch-mode) isearch-regexp)
-			     Info-search-whitespace-regexp)))
+		  (let ((search-spaces-regexp Info-search-whitespace-regexp))
 		    (if (if backward
 			    (re-search-backward regexp nil t)
 			  (re-search-forward regexp nil t))



  reply	other threads:[~2012-08-28  8:28 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15  4:40 Interpretation of a space in regexp isearch? Dmitry Gutov
2012-08-15  5:27 ` Bastien
2012-08-15  9:11   ` Dani Moncayo
2012-08-15  9:13     ` Dani Moncayo
2012-08-15  9:19     ` Dani Moncayo
2012-08-15 13:59     ` Drew Adams
2012-08-15 14:31       ` Davis Herring
2012-08-15 16:43         ` Drew Adams
2012-08-15 17:54           ` Davis Herring
2012-08-15 22:53       ` Dmitry Gutov
2012-08-15 23:21         ` Drew Adams
2012-08-16  2:25           ` Dmitry Gutov
2012-08-16  5:37             ` Drew Adams
2012-08-26  4:06     ` Chong Yidong
2012-08-26  6:59       ` Bastien
2012-08-26 15:19       ` Dani Moncayo
2012-08-26 17:31         ` Dani Moncayo
2012-08-28  8:28           ` Juri Linkov [this message]
2012-08-28  9:07             ` Dani Moncayo
2012-08-28 23:01               ` Juri Linkov
2012-08-27 18:34       ` Johan Bockgård
2012-08-28  8:30         ` Juri Linkov
2012-08-28 12:53           ` Stefan Monnier
2012-08-28 22:54             ` Juri Linkov
2012-08-28 23:52               ` Drew Adams
2012-08-29  8:38                 ` Juri Linkov
2012-08-29 16:01                   ` Drew Adams
2012-08-29 23:49                     ` Juri Linkov
2012-08-30  8:19               ` Chong Yidong
2012-08-30  8:31                 ` Chong Yidong
2012-08-30  8:54                   ` Juri Linkov
2012-08-30 14:47                     ` Stefan Monnier
2012-08-31  0:02                       ` Juri Linkov
2012-08-31  0:07                   ` Juri Linkov
2012-08-31  5:40                     ` Chong Yidong
2012-08-31  9:31                       ` Juri Linkov
2012-08-31 14:55                         ` Chong Yidong
2012-09-01  0:47                           ` Juri Linkov
2012-09-01  3:15                             ` Chong Yidong
2012-09-01 11:50                               ` Juri Linkov
2012-09-01 16:02                                 ` Chong Yidong
2012-08-29  6:46           ` Chong Yidong
2012-08-29  8:28             ` Juri Linkov
2012-08-29 13:55               ` Stefan Monnier
2012-08-29 15:11                 ` Dani Moncayo
2012-08-29 23:51                 ` Juri Linkov
2012-08-28  8:27       ` Juri Linkov
2012-08-29  6:59         ` Chong Yidong
2012-08-29  8:34           ` Juri Linkov
2012-08-30  9:01         ` Chong Yidong
2012-08-30  9:18           ` Juri Linkov
  -- strict thread matches above, loose matches on Subject: below --
2012-08-14 23:45 Dmitry Gutov
2012-08-14 23:03 Bastien
2012-08-14 23:45 ` Davis Herring
2012-08-14 23:53   ` Bastien
2012-08-15  3:42     ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ligzto77.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=cyd@gnu.org \
    --cc=dmoncayo@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).