[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with whitespaces in search
From: |
Philippe Delavalade |
Subject: |
Re: Problem with whitespaces in search |
Date: |
Thu, 28 Jan 2016 16:36:34 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Le jeudi 28 janvier à 16:24, Bob Proulx a écrit :
> Philippe Delavalade wrote:
> > I have just noticed a problem when searching whitespaces. I'm using version
> > 24.3.1 under linux/slackware 14.1.
> >
> > For instance, with a file containing the unique line
> >
> > abcd fghix jklmxx nopqxxx
> >
> > and with the cursor on column 0, when searching whitespaces (incremental or
> > not), the cursor comes under the 'f' which is normal but it stays their
> > even when typing many ' '.
> >
> > This does not happen with 'x' for instance.
> >
> > What can I do to avoid this and find many whitespaces ?
> >
> > I hope have been clear and sorry for my poor english.
>
> This is a case where something that is a feature for one person is a
> bug to another person. I always disable "lax space matching" myself.
>
> This is documented here:
>
>
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Special-Isearch.html
>
> It isn't clear exactly what you are wishing. You might be wanting to
> set search-whitespace-regexp to nil to disable the feature?
>
> (setq search-whitespace-regexp nil)
>
> See also the builtin documentation on search-whitespace-regexp.
>
> (describe-variable 'search-whitespace-regexp)
>
> search-whitespace-regexp is a variable defined in `isearch.el'.
> Its value is nil
> Original value was "\\s-+"
>
> Documentation:
> If non-nil, regular expression to match a sequence of whitespace chars.
> When you enter a space or spaces in the incremental search, it
> will match any sequence matched by this regexp. As an exception,
> spaces are treated normally in regexp incremental search if they
> occur in a regexp construct like [...] or *, + or ?.
>
> If the value is a string, it applies to both ordinary and
> regexp incremental search. If the value is nil, or
> `isearch-lax-whitespace' is nil for ordinary incremental search, or
> `isearch-regexp-lax-whitespace' is nil for regexp incremental search,
> then each space you type matches literally, against one space.
>
> You might want to use something like "[ \t\r\n]+" instead.
> In the Customization buffer, that is `[' followed by a space,
> a tab, a carriage return (control-M), a newline, and `]+'.
Thanks Bob. I was wishing to find sequence of whitespaces ; so I followed
Tomas help and put
(setq isearch-lax-whitespace nil)
in .emacs and now I have what I expect.
I'll have a look to your link.
For regexp, it was working 'normally' for me :-)
Regards.
--
Ph. Delavalade