[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: Drew Adams
Subject: RE: Isearch: retrieve last successful search string from when you quit (`C-g')
Date: Mon, 1 Oct 2012 08:17:49 -0700

> > I guess for a long time I've sub-thought, without 
> > considering it consciously, that it might be good to get
> > back that last successful search string -- the one
> > I was searching with when I hit `C-g' to quit searching -- 
> > for reuse later.  But it's not saved on the search rings
> > (which makes sense), so it is not available.
> > `C-g' means bye-bye.
> As you say, someone might want that last successful search string to
> be stored in the search ring (I've sometimes expected it).

No, I did not say that.  In fact, I said that it makes sense that it NOT be
added to the search rings.

I said that it would sometimes be useful to retrieve that string for a later
search.  That's not the same thing as treating it the same as the strings on the

> So I think that the proper solution would be to let the user decide
> whether C-g from a I-search session saves the current search string in
> the search ring.

1. If you mean systematically, e.g. via a user option, then that is a bad idea,
IMO.  I, for one, do not want abandoned searches polluting my search rings.

But I do want to be able to get back the _last_ abandoned search string on
demand, for reuse.  What Isearch+ does is save only the last abandoned search
strings (separately for simple search and regexp search).  It specifically does
not add those to the search rings.

2. If you instead meant that a user would signal this intention when hitting C-g
(prefix arg or some such), then that would be pretty useless, IMHO.  At the time
you hit C-g you typically do not know whether you might later want to reuse that
search string.  And again, it should not be saved to the search rings.

> That, IMO, would be a better (more intuitive/consistent) solution that
> taking another key for retrieving the last successful search string
> (which is already doable with "C-s C-s" or "C-s M-p").

This is not about the last search where you moved to a search hit and stayed
there.  That is what is recorded in the search rings and so is available via C-s
C-s.  Those are not only successful searches in terms of finding hits; they are
also searches that you have accepted, i.e., used to move to a hit and stay

That meaning for the search rings should be kept, IMO.  It is what you want 99%
of the time.  You do not want to wade through a myriad of successful but
unused/unaccepted searches on the ring, to find and reuse a search that you
actually followed.

This is about retrieving the last successful search string where you canceled
searching using C-g, and so did not stay at any of its hits.  It's about letting
you insert that string later, adding (appending) it to the current search

It is very simple.  Just hit `M-g' to yank the string into the current search.

This is a one-off, occasional thing - nowhere near as frequent as reusing a
search that you actually followed.  Just imagine saving your search rings
persistently (e.g. via savehist.el), to see the folly of saving each successful
but abandoned search string.

reply via email to

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