[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Interpretation of a space in regexp isearch?
From: |
Juri Linkov |
Subject: |
Re: Interpretation of a space in regexp isearch? |
Date: |
Tue, 28 Aug 2012 11:28:44 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) |
> 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))
- RE: Interpretation of a space in regexp isearch?, (continued)
- Re: Interpretation of a space in regexp isearch?, Dmitry Gutov, 2012/08/15
- RE: Interpretation of a space in regexp isearch?, Drew Adams, 2012/08/15
- Re: Interpretation of a space in regexp isearch?, Dmitry Gutov, 2012/08/15
- RE: Interpretation of a space in regexp isearch?, Drew Adams, 2012/08/16
- Re: Interpretation of a space in regexp isearch?, Chong Yidong, 2012/08/26
- Re: Interpretation of a space in regexp isearch?, Bastien, 2012/08/26
- Re: Interpretation of a space in regexp isearch?, Dani Moncayo, 2012/08/26
- Re: Interpretation of a space in regexp isearch?, Dani Moncayo, 2012/08/26
- Re: Interpretation of a space in regexp isearch?,
Juri Linkov <=
- Re: Interpretation of a space in regexp isearch?, Dani Moncayo, 2012/08/28
- Re: Interpretation of a space in regexp isearch?, Juri Linkov, 2012/08/28
- Re: Interpretation of a space in regexp isearch?, Johan Bockgård, 2012/08/27
- Re: Interpretation of a space in regexp isearch?, Juri Linkov, 2012/08/28
- Re: Interpretation of a space in regexp isearch?, Stefan Monnier, 2012/08/28
- Re: Interpretation of a space in regexp isearch?, Juri Linkov, 2012/08/28
- RE: Interpretation of a space in regexp isearch?, Drew Adams, 2012/08/28
- Re: Interpretation of a space in regexp isearch?, Juri Linkov, 2012/08/29
- RE: Interpretation of a space in regexp isearch?, Drew Adams, 2012/08/29
- Re: Interpretation of a space in regexp isearch?, Juri Linkov, 2012/08/29