unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Chong Yidong" <cyd@stupidchicken.com>
Cc: rms@gnu.org
Subject: Re: search-whitespace-regexp
Date: Sat, 5 Feb 2005 20:59:46 -0500 (EST)	[thread overview]
Message-ID: <35379.203.116.59.24.1107655186.squirrel@203.116.59.24> (raw)
In-Reply-To: <E1CxTtu-0001em-5a@fencepost.gnu.org>

>     However, I believe that
>     using search-whitespace-regexp in isearch-forward-regexp is a
>     misfeature. It should instead be used for isearch-forward.
>
> For years, string search has treated characters literally while regexp
> search has treated space as "any whitespace".  To reverse this would
> be an incompatible change that would affect every user.
>
> I think you're the first person ever to ask for this change.  I think
> it would cause more trouble than benefit.
>
> However, if a poll of users is done, and we find that most users would
> prefer this change, I would consider it.

In that case, I propose just changing string search, using a variable
search-whitespace, analogous to search-whitespace-regexp. This should
default to nil, so that the default behavior of string search is identical
to Emacs 21.3 and below. If the user customizes the value, he gets the
"magical space" behavior.

I have come across several complaints about newlines interfering with
string search. For example, a website called "Emacs for Writers", which is
written by a professional writer and non-programmer who uses Emacs, says
this:

http://www.therandymon.com/linux/woodnotes/emacswriter/node15.html
   One limitation of regular searches in documents that have been formatted
   (filled) is that if the two words are separated by a newline, the
   incremental search function won't find them.

He goes on to recommend using word search, but the problem with word
search is that it is not incremental. As I have mentioned, regular
expression search is also problematic for casual use, especially if the
user is unfamiliar with regexp syntax, because characters like "." have
special meaning.

A cursory search through Google turned up indicates that there have been
plenty of user requests for something like this over the years. For
example:

http://groups.google.com.sg/groups?selm=199803011846.NAA30567%40feedback.princeton.edu&output=gplain
  I edit tex documents (such as my thesis), and I usually find locations
  in a document using isearch (^S).  Searching for a couple words in a
  row (say "the dog") is usually enough to narrow down the location.
  However, if "the" and "dog" are separated by a newline, then isearch
  won't find them...

  Is there a totally different approach that would make plain iserach
  smart enough to understand that SPACE could be a newline (or a tab)?
  The advantage of using plain isearch instead of regexp isearch is that
  I wouldn't have to escape special characters like "[".

  reply	other threads:[~2005-02-06  1:59 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 ` search-whitespace-regexp Stefan Monnier
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   ` Chong Yidong [this message]
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=35379.203.116.59.24.1107655186.squirrel@203.116.59.24 \
    --to=cyd@stupidchicken.com \
    --cc=rms@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).