all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to make emacs clear search when pressing Ctrl+g?
@ 2010-02-10 21:34 Joseph Garvin
  2010-02-11  6:02 ` Kevin Rodgers
  0 siblings, 1 reply; 2+ messages in thread
From: Joseph Garvin @ 2010-02-10 21:34 UTC (permalink / raw)
  To: help-gnu-emacs

Sometimes when I'm doing a forward search (Ctrl+s) I realize I
actually wanted to search for something different. As a shortcut to
clear the search rather than having to backspace, I press Ctrl+g to
cancel the search then press Ctrl+s again to begin a new search. But
if you do this without moving the cursor between the Ctrl+g and the
Ctrl+s steps, then the minibuffer will keep what I was searching for
before in it, defeating the whole point. Is there a good reason this
is the default behavior? I'm not sure what the advantage would be. And
regardless, is there an easy way to make it always clear as if I had
moved the cursor between the Ctrl+g and Ctrl+s steps?




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to make emacs clear search when pressing Ctrl+g?
  2010-02-10 21:34 How to make emacs clear search when pressing Ctrl+g? Joseph Garvin
@ 2010-02-11  6:02 ` Kevin Rodgers
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Rodgers @ 2010-02-11  6:02 UTC (permalink / raw)
  To: help-gnu-emacs

Joseph Garvin wrote:
> Sometimes when I'm doing a forward search (Ctrl+s) I realize I
> actually wanted to search for something different. As a shortcut to
> clear the search rather than having to backspace, I press Ctrl+g to
> cancel the search then press Ctrl+s again to begin a new search. But
> if you do this without moving the cursor between the Ctrl+g and the
> Ctrl+s steps, then the minibuffer will keep what I was searching for
> before in it, defeating the whole point. Is there a good reason this
> is the default behavior? I'm not sure what the advantage would be. And
> regardless, is there an easy way to make it always clear as if I had
> moved the cursor between the Ctrl+g and Ctrl+s steps?

,----
| File: emacs,  Node: Error in Isearch,  Next: Special Isearch,  Prev: Repeat 
Isearch,  Up: Incremental Search
|
| 20.1.3 Errors in Incremental Search
-----------------------------------|
|
| If your string is not found at all, the echo area says `Failing
| I-Search'.  The cursor is after 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'.  At this
| point there are several things you can do.  If your string was
| mistyped, you can rub some of it out and correct it.  If you like the
| place you have found, you can type <RET> or some other Emacs command 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 `C-g' "quit" character 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.  The cursor moves 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.
|
`----

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-11  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-10 21:34 How to make emacs clear search when pressing Ctrl+g? Joseph Garvin
2010-02-11  6:02 ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.