[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: search-whitespace-regexp
From: |
Stefan Monnier |
Subject: |
Re: search-whitespace-regexp |
Date: |
Fri, 04 Feb 2005 10:17:14 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
> --- 2023,2043 ----
> (isearch-regexp
> (if isearch-forward 're-search-forward 're-search-backward))
> (t
> ! (if isearch-forward 'isearch-search-forward
> 'isearch-search-backward)))))
> !
> ! (defun isearch-search-forward (string &optional bound noerror count)
> ! (re-search-forward
> ! (if search-whitespace-regexp
> ! (replace-regexp-in-string " +" search-whitespace-regexp string)
> ! string)
> ! bound noerror count))
> !
> ! (defun isearch-search-backward (string &optional bound noerror count)
> ! (re-search-backward
> ! (if search-whitespace-regexp
> ! (replace-regexp-in-string " +" search-whitespace-regexp string)
> ! string)
> ! bound noerror count))
I generally agree with your proposal to change the behavior of isearch such
that only plain search uses a "magical space", whereas regexp search is made
more "raw". But the above code is wrong in that it fails to quote
chars like "[" in the search string.
You probably want to use something like
(re-search-forward (mapconcat 'regexp-quote
(split-string string)
search-whitespace-regexp)
bound noerror count)
instead,
Stefan
- search-whitespace-regexp, Chong Yidong, 2005/02/04
- Re: search-whitespace-regexp, Andreas Schwab, 2005/02/04
- Re: search-whitespace-regexp,
Stefan Monnier <=
- Re: search-whitespace-regexp, Richard Stallman, 2005/02/05
- Re: search-whitespace-regexp, Chong Yidong, 2005/02/05
- Re: search-whitespace-regexp, Richard Stallman, 2005/02/06
- Re: search-whitespace-regexp, Stefan Monnier, 2005/02/06
- Re: search-whitespace-regexp, Miles Bader, 2005/02/06
- Re: search-whitespace-regexp, Stefan Monnier, 2005/02/06
- Re: search-whitespace-regexp, Miles Bader, 2005/02/06
- RE: search-whitespace-regexp, Drew Adams, 2005/02/06
- Re: search-whitespace-regexp, Miles Bader, 2005/02/06