emacs-devel
[Top][All Lists]
Advanced

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

RE: highlight failed part of isearch input


From: Drew Adams
Subject: RE: highlight failed part of isearch input
Date: Wed, 11 Jul 2007 14:14:12 -0700

>     When you search for such a string, Emacs does not let you simply
>     use `DEL' to back out the failure part, character by character ...
>
> To back out of a failure, invoke isearch-del-char (`C-M-w').  That
> deletes one character from the end of the search string and searches
> again.

I see; thanks. I wasn't aware of that. It's new with Emacs 22, apparently,
and I hadn't come across it yet.

>     When you search for such a string, Emacs does not let you simply
>     use `DEL' to back out the failure part, character by character;
>     hitting `DEL' removes the entire search string at once.
>
> isearch-delete-char (`DEL') only removes the entire search string if
> you use isearch-yank-word-or-char (`C-w') and only if you also make
> that word be the only part of the search string.  If you invoke
> isearch-yank-word-or-char (`C-w') twice, isearch-delete-char (`DEL')
> removes only the last.

emacs -Q
In a buffer with text abcd, use `C-s abx RET'. Then use `C-s C-s DEL'. For
me, it removes the entire search string. You say that if I do not use `C-w'
during Isearch then `DEL' will not remove the entire search string, which is
not what I see. Am I misunderstanding you?

> You can use isearch-yank-word-or-char (`C-w') to gather a complete
> word and then remove characters from that string with isearch-del-char
> (`C-M-w').

Yes, `C-M-w' is new with Emacs 22. I was not aware of it.

Consequently, I withdraw what I wrote. Since you can now back out of a
repeat search incrementally (with `C-M-w'), I agree that it could be OK to
highlight only the failure part in the case of a repeat search also.

I notice something that strikes me as perhaps a bug, but I don't know which
behavior was intended by `C-M-w'. If you use `C-s abx C-a' in a buffer with
only `abcd', and then you use `C-s C-s C-M-w', the search string is changed
from `abx' to `ab', but the prompt/echo still says "Failing", which is not
really correct. In fact, it has not yet searched again with the updated
search string from `C-M-w' - you must hit `C-s' again to start the search
(which does not fail). Similarly, even without the repeated search: if you
use `C-s abx C-M-w', then the current search position is maintained, but the
minibuffer still says "Failing".

Is this a feature or a bug? `C-M-w' just edits the search string,
apparently; the edited string is not sought until you hit `C-s' again.
That's OK, I guess, but it means that subtracting search-string text with
`C-M-x' is not an inverse of adding it by typing additional characters.

In any case, shouldn't the prompt/echo indicate the state of the current
search position? That is, if backing out a character makes the current
search successful, shouldn't the indication change from "Failing" to
"Isearch" (even if `C-M-x' is limited to editing the search string)?

If this is the intended behavior, then there is all the more reason for
fixing the failure-part highlighting, so that at least it (even if not the
prompt) correctly reflects the current state.

In case of a repeated search that fails, followed by sufficient `C-M-w' to
reach success, shouldn't success also mean moving to the first match? That
is, should the fact that `C-M-w' only edits the search string be maintained
also for a repeated search?

WDOT?






reply via email to

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