unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: search-whitespace-regexp
Date: Fri, 04 Feb 2005 10:17:14 -0500	[thread overview]
Message-ID: <jwvis589x4t.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <1982.220.255.95.17.1107526353.squirrel@220.255.95.17> (Chong Yidong's message of "Fri, 4 Feb 2005 09:12:33 -0500 (EST)")

> --- 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

  parent reply	other threads:[~2005-02-04 15:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-04 14:12 search-whitespace-regexp Chong Yidong
2005-02-04 14:36 ` search-whitespace-regexp Andreas Schwab
2005-02-04 15:22   ` search-whitespace-regexp Chong Yidong
2005-02-04 15:27   ` search-whitespace-regexp Chong Yidong
2005-02-04 15:17 ` Stefan Monnier [this message]
2005-02-04 15:55   ` search-whitespace-regexp Chong Yidong
2005-02-05 17:39 ` search-whitespace-regexp Richard Stallman
2005-02-06  1:59   ` search-whitespace-regexp Chong Yidong
2005-02-06 12:42     ` search-whitespace-regexp Richard Stallman
2005-02-06 16:21     ` search-whitespace-regexp Stefan Monnier
2005-02-06 22:39       ` search-whitespace-regexp Miles Bader
2005-02-06 22:49         ` search-whitespace-regexp Stefan Monnier
2005-02-06 23:17           ` search-whitespace-regexp Miles Bader
2005-02-07  0:28             ` search-whitespace-regexp Drew Adams
2005-02-07  0:41               ` search-whitespace-regexp Miles Bader
2005-02-07  1:36                 ` search-whitespace-regexp Chong Yidong
2005-02-07  4:12                   ` search-whitespace-regexp Drew Adams
2005-02-07  9:48                 ` search-whitespace-regexp Andreas Schwab
2005-02-07 20:51                 ` search-whitespace-regexp Richard Stallman
2005-02-07 20:51       ` search-whitespace-regexp Richard Stallman
2005-02-07 21:07         ` search-whitespace-regexp Stefan Monnier
2005-02-08  0:01           ` search-whitespace-regexp Miles Bader

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=jwvis589x4t.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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).