emacs-devel
[Top][All Lists]
Advanced

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

Re: word search (Re: isearch in Dired)


From: Stefan Monnier
Subject: Re: word search (Re: isearch in Dired)
Date: Thu, 31 Jul 2008 10:10:48 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> Actually incremental word search is useless.  While typing a sequence of
> words, incremental word search advances forward through false positives
> and failures because it tries to match on all incomplete word boundaries.
> When the user finishes typing a complete sequence of words, the current
> match may skip some matches from the starting point.  So this behavior
> makes more harm!

I'm not sure what you mean by "this behavior".  If you mean the behavior
of M-s w, then it's no worse than what we had before, right?  And it
does allow circumventing this problem in some cases if you use "C-s
<words> M-s w".

The right behavior for word search would be to only add a "word
boundary" at the end of the pattern when the user is done entering
the pattern.  Since isearch has no such notion of "done entering the
pattern", getting things right requires extra changes. 

Your suggestion to just revert to a non-incremental search might be
a good one.  But I think it gives up a bit too early.  We should first
try harder to make incremental word search work.

E.g. we could provide a key that says "here, I'm done entering the
pattern".  That key could be C-s/C-r or RET, or something else.
Entering more text should probably revert back to "the pattern is not
done yet".

Thinking a bit more about it, there's already a key that will do just
that: SPC.  So I suggest we change isearch to not use
word-search-forward but use its own implementation of it that only adds
a trailing \b if the last char of the pattern is a word constituent.
It should give us the right behavior.

> So I propose to display a warning after typing C-w in the isearch-edit-string
> minibuffer that this feature is obsolete and suggest using `M-s w' instead
> for the upcoming release.  After this release, we can eliminate it completely
> or replace with word-yanking.

Fine by me.

> This feature is useful for regexp Isearch as well because often it is
> distracting to see warnings "incomplete input" while typing a complex
> regexp in Isearch mode.

I completely disagree.  I always use C-u C-s ... M-% to do regexp
search&replace specifically because it's so much more convenient to be
able to enter the regexp incrementally.  If you're bothered by the
"incomplete input" warning, we should try and address that directly.


        Stefan




reply via email to

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