From: Juri Linkov <juri@jurta.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: Chong Yidong <cyd@stupidchicken.com>, emacs-devel@gnu.org
Subject: Re: word search (Re: isearch in Dired)
Date: Thu, 31 Jul 2008 18:16:59 +0300 [thread overview]
Message-ID: <87r69a6q38.fsf@jurta.org> (raw)
In-Reply-To: <jwv63qmxivv.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 31 Jul 2008 10:10:48 -0400")
>> 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/
next prev parent reply other threads:[~2008-07-31 15:16 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-08 3:05 propose: dired-isearch.el --- isearch in Dired William Xu
2007-08-08 3:47 ` Levin
2007-08-08 5:29 ` William Xu
2007-08-08 8:12 ` Herbert Euler
2007-08-08 8:16 ` Miles Bader
2007-08-08 9:35 ` William Xu
2007-08-08 13:01 ` Stefan Monnier
2007-08-09 2:45 ` Miles Bader
2007-08-08 18:46 ` Stefan Monnier
2007-08-08 22:54 ` Juri Linkov
2008-07-23 20:34 ` Juri Linkov
2008-07-24 6:41 ` Mathias Dahl
2008-07-25 0:32 ` Juri Linkov
2008-07-24 13:53 ` Stefan Monnier
2008-07-24 15:52 ` Drew Adams
2008-07-24 17:20 ` Stefan Monnier
2008-07-24 17:31 ` dired-details status [was: isearch in Dired] Drew Adams
2008-07-25 0:33 ` isearch in Dired Juri Linkov
2008-07-25 0:40 ` Lennart Borgman (gmail)
2008-07-29 15:44 ` word search (Re: isearch in Dired) Juri Linkov
2008-07-29 17:22 ` Chong Yidong
2008-07-30 16:50 ` Juri Linkov
2008-07-31 12:35 ` Juri Linkov
2008-07-31 14:10 ` Stefan Monnier
2008-07-31 15:16 ` Juri Linkov [this message]
2008-07-31 16:30 ` Stefan Monnier
2008-07-31 15:24 ` Stefan Monnier
2008-07-29 15:45 ` isearch in Dired Juri Linkov
2008-07-29 17:56 ` Stefan Monnier
2008-07-30 14:29 ` Juri Linkov
2007-08-09 2:46 ` propose: dired-isearch.el --- " William Xu
2007-08-09 0:06 ` Richard Stallman
2007-08-09 1:53 ` William Xu
2007-08-09 23:11 ` Richard Stallman
2007-08-10 1:42 ` William Xu
2007-08-10 8:37 ` Mathias Dahl
2007-08-10 9:22 ` David Kastrup
2007-08-10 15:56 ` Drew Adams
2007-08-11 10:52 ` William Xu
2007-08-11 15:15 ` Drew Adams
2007-08-11 16:58 ` Robert J. Chassell
2007-08-12 1:02 ` Drew Adams
2007-08-12 20:46 ` Juri Linkov
2007-08-12 21:43 ` Drew Adams
2007-08-12 23:23 ` Juri Linkov
2007-08-13 9:14 ` Mathias Megyei
2007-08-13 9:24 ` Andreas Schwab
2007-08-13 13:09 ` Mathias Dahl
2007-08-09 16:07 ` Drew Adams
2007-08-09 2:37 ` Herbert Euler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r69a6q38.fsf@jurta.org \
--to=juri@jurta.org \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).