emacs-devel
[Top][All Lists]
Advanced

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

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


From: Juri Linkov
Subject: Re: Isearch: retrieve last successful search string from when you quit (`C-g')
Date: Mon, 01 Oct 2012 20:49:56 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu)

> For what others have proposed, just alter the definition of `isearch-abort' in
> isearch.el, like this (untested):
>
> (defun isearch-abort ()
>   "Abort incremental search mode if searching is successful, signaling quit.
> Otherwise, revert to previous successful search and continue searching.
> Use `isearch-exit' to quit without signaling."
>   (interactive)
>   (discard-input)
>   (if (and isearch-success (not isearch-error))
>       (progn
>         (setq isearch-success nil)
>
>         ;; ADD THIS LINE <===============
>         (isearch-update-ring isearch-string isearch-regexp)

If someone will be willing to implement this, 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.

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.

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'.



reply via email to

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