[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Interpretation of a space in regexp isearch?

From: Drew Adams
Subject: RE: Interpretation of a space in regexp isearch?
Date: Wed, 15 Aug 2012 06:59:21 -0700

> >>> FWIW, I've long been of the opinion that this feature is
> >>> exactly backward.  The `search-whitespace-regexp' whitespace 
> >>> matching feature should apply to ordinary incremental search,
> >>> and it should *not* apply to regexp incremental search.
> >>
> >> I think that would make more sense, too.
> > My opinion too.
> +1
> IMO, that feature is what the user usually wants in an ordinary search
> (regardless it's incremental or not; even if that search is part of a
> ordinary replace command).
> On the other and, in a rexexp search (or regexp search&replace) I
> think that the common case is the opposite: the user normally doesn't
> want that feature.
> So, what about making that feature optional for these two scenarios?
> ("on" by default in the regexp case and "off" by default in the normal
> case).


We've been through this before, I think, but...

By default, "magic-space" searching should be OFF for both simple and regexp
search.  Each SPC you type should search for a single SPC, by default.  Simple.
No surprise.

Others have given reasons for the regexp case (+1).  For the simple-search case:
I do not think it is appropriate for users, especially newbies, to have to
figure out and use `C-q SPC' (WTF?) to search for a single SPC char.

I do agree, however, that magic-space searching can be very useful, and it
should be easily available, via a toggle key, for both simple and regexp

The best approach is to *let users decide*:

* Treat both simple and regexp search the same way.

* Have a Boolean variable that controls the behavior:
  literal-SPC or magic-space searching.

* Have a toggle key that flips the Boolean value.
  The new value stays in effect (including in future
  searches for the same session) until flipped again.
  (Some candidates for the key: `M-SPC', `M-s SPC'.)

* The variable's default value provides literal SPC search
  as the default (i.e., initial) behavior - for all searches:
  simple & regexp.

* Users can set the variable value in their init files, if
  they want to change the default (i.e., initial) behavior.

(Personally, I would prefer that the variable be a defcustom, but I'm a

[Even without this proposal, the doc for Isearch (e.g. C-s C-h m) should mention
the behavior of SPC in a regexp search - it is currently silent about this.
With this proposal, it should mention the two SPC behaviors and the toggle key.]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]