[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Isearch should store aborted search strings too
From: |
Juri Linkov |
Subject: |
Re: Isearch should store aborted search strings too |
Date: |
Wed, 07 Dec 2011 18:45:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (x86_64-pc-linux-gnu) |
> I often use isearch to check something in other parts of the
> file and then go back to the starting point by aborting isearch
> with ctrl+G.
>
> When I abort it then isearch doesn't store the search string which
> I often need again, so I have to type it again. I recommend
> adding and option to control this behavior and store the search string
> even if aborting.
Without an option this can be achieved with:
(add-hook 'isearch-mode-end-hook
(lambda ()
(isearch-update-ring isearch-string isearch-regexp)))
> This could even be the default, since previous search strings can
> be trivially accessed with M-p, so it's no problem if more
> strings are stored than before.
Often previous useless search strings is a problem that I even use code
in .emacs in `isearch-mode-end-hook' that removes the search string
even on successful exit:
;; Don't push the search string into the search ring
;; (i.e. remove the stored search string)
(if isearch-regexp
(setq regexp-search-ring (cdr regexp-search-ring))
(setq search-ring (cdr search-ring)))