[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 11:21:34 -0700

> > For what others have proposed, just alter the definition of 
> > `isearch-abort' in isearch.el, like this (untested):
> >
> >         ;; ADD THIS LINE <===============
> >         (isearch-update-ring isearch-string isearch-regexp)
> If someone will be willing to implement this,

Not I.  I am not in favor of that approach.  If it is implemented then I, for
one, will opt out of it.

> then better would be to
> add a new arg to `isearch-cancel' propagating its value to the arg
> NOPUSH of `isearch-done'.

> And also add a new arg to `isearch-abort',
> and maybe even make it a prefix arg C-u, e.g. `C-g' saves the search
> string to the search ring, but `C-u C-g' doesn't.

Ugh.  Again, at the time you cancel using C-g, you probably do not know whether
you might later want to reuse that search string.  This approach makes no sense
to me.

> But really I see no need to do this.  You can do the same by exiting
> normally with RET and jumping back to the mark with `C-u C-SPC'
> to return to where you were before beginning the search.

I almost mentioned that as well.  But again, that presumes that you have a good
idea at that time whether you might want to reuse the search string.  Not a good

My suggestion was not about putting the search string on the history, and it was
not about reusing the search string only as a _replacement_ search.  It was
about reusing such a search string by yanking it into the current search, even
if that is not empty.

You can yank it into the search string any number of times (repetitions).  And
it does not pollute your search rings, which continue to contain only searches
you have used (followed to some hit and stayed there).  It is handled pretty
much the same way yanking a kill into the search string is handled.

> If you want to put the search string to the kill ring
> (instead of the search ring) before canceling Isearch,
> then you can do `M-e C-k C-g C-g'.

See above.  You typically do not know whether you want to reuse the current
search string at the time you quit with C-g.

reply via email to

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