[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: word search (Re: isearch in Dired)
From: |
Juri Linkov |
Subject: |
Re: word search (Re: isearch in Dired) |
Date: |
Thu, 31 Jul 2008 18:16:59 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) |
>> 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?
I meant the behavior of the global binding `M-s w' that I've
installed yesterday. I discovered that it needs immediate fixing
since incremental word search doesn't work satisfactorily.
> 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.
I suggest to revert not to a completely non-incremental search like
what `word-search-forward' does interactively, but still starting a
normal incremental search after reading a sequence of words. This
can be labelled as "initially non-incremental word search".
> 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.
This is what `isearch-edit-string' does in a less surprising way
because every Emacs user knows that RET exits the minibuffer
in contrast with typing RET to finish a sequence of words
in incremental word search.
> 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.
Typing SPC to mark the end of the word sequence is not obvious too,
but perhaps with enough documentation might provide a convenient UI
for incremental word search. I see this can be implemented in a way
similar to using the variable `search-whitespace-regexp' in regexp search.
>> 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.
Sometimes it is sufficient to write a regexp non-incrementally without
paying attention where it matches during typing. But really this is
not important since there is already the key `M-e', so it is easy
to type `C-u C-s M-e' when necessary.
--
Juri Linkov
http://www.jurta.org/emacs/
- RE: isearch in Dired, (continued)
- Re: isearch in Dired, Juri Linkov, 2008/07/24
- Re: isearch in Dired, Lennart Borgman (gmail), 2008/07/24
- Re: word search (Re: isearch in Dired), Juri Linkov, 2008/07/29
- Re: word search (Re: isearch in Dired), Chong Yidong, 2008/07/29
- Re: word search (Re: isearch in Dired), Juri Linkov, 2008/07/30
- Re: word search (Re: isearch in Dired), Juri Linkov, 2008/07/31
- Re: word search (Re: isearch in Dired), Stefan Monnier, 2008/07/31
- Re: word search (Re: isearch in Dired),
Juri Linkov <=
- Re: word search (Re: isearch in Dired), Stefan Monnier, 2008/07/31
- Re: word search (Re: isearch in Dired), Stefan Monnier, 2008/07/31
- Re: isearch in Dired, Juri Linkov, 2008/07/29
- Re: isearch in Dired, Stefan Monnier, 2008/07/29
- Re: isearch in Dired, Juri Linkov, 2008/07/30