daveg
daveg

Reputation: 1211

How can I make emacs find the next space

emacs version "emacs-24.3" on linux

If I am at the start of this line...

a    b

(where single spaces are the spaces between the letters) When I use ctrl-s and then hit the space bar to get the next space, it jumps to the space just before the 'b' instead of the space right after the a. It doesn't behave like this for other characters. It looks like someone went to great lengths to enable this behavior as some sort of feature. But I find it very annoying. How can I shut this off? How can I make it treat spaces like any other character when searching for characters/strings ?

my ~/.emacs does nothing except define keys. inhibit splash and startup screens and change fg/bg colors.

Upvotes: 0

Views: 488

Answers (2)

amalloy
amalloy

Reputation: 92037

If you press C-h k C-s, you will see the help text for isearch-forward. It contains this section:

Type M-s SPC to toggle whitespace matching. In incremental searches, a space or spaces normally matches any whitespace defined by the variable search-whitespace-regexp; see also the variables isearch-lax-whitespace and isearch-regexp-lax-whitespace.

Upvotes: 5

Andreas Sahlbach
Andreas Sahlbach

Reputation: 228

Use

(customize-set-variable 'search-whitespace-regexp nil)

or use customize to set the variable to nil.

Upvotes: 3

Related Questions