[Top][All Lists]

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

Re: Isearch: retrieve last successful search string from when you quit (

From: Eli Zaretskii
Subject: Re: Isearch: retrieve last successful search string from when you quit (`C-g')
Date: Tue, 02 Oct 2012 18:48:20 +0200

> From: Nix <address@hidden>
> Emacs: (setq software-quality (/ 1 number-of-authors))
> Date: Tue, 02 Oct 2012 12:26:21 +0100
> Cc: Stefan Monnier <address@hidden>,
>       Drew Adams <address@hidden>, address@hidden
> Perhaps I'm just an idiot, but I always thought the current
> isearch behaviour of not immediately quitting when C-g was stuck on a
> failed search was a *bug*. Only now, after Drew commented on it, do I
> notice that it's removing the unfound component of the failed search:
> i.e., it's a feature, but unless you spend your time looking at the echo
> area while isearching (and who does that?) they'll never notice it.

They could read the manual.

  15.1.3 Errors in Incremental Search

  If your string is not found at all, the echo area says `Failing
  I-Search', and the cursor moves past the place where Emacs found as
  much of your string as it could.  Thus, if you search for `FOOT', and
  there is no `FOOT', you might see the cursor after the `FOO' in `FOOL'.
  In the echo area, the part of the search string that failed to match is
  highlighted using the face `isearch-fail'.

     At this point, there are several things you can do.  If your string
  was mistyped, you can use <DEL> to erase some of it and correct it.  If
  you like the place you have found, you can type <RET> to remain there.
  Or you can type `C-g', which removes from the search string the
  characters that could not be found (the `T' in `FOOT'), leaving those
  that were found (the `FOO' in `FOOT').  A second `C-g' at that point
  cancels the search entirely, returning point to where it was when the
  search started.

     The quit command, `C-g', does special things during searches; just
  what it does depends on the status of the search.  If the search has
  found what you specified and is waiting for input, `C-g' cancels the
  entire search, moving the cursor back to where you started the search.
  If `C-g' is typed when there are characters in the search string that
  have not been found--because Emacs is still searching for them, or
  because it has failed to find them--then the search string characters
  which have not been found are discarded from the search string.  With
  them gone, the search is now successful and waiting for more input, so
  a second `C-g' will cancel the entire search.

reply via email to

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