all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Tom <adatgyujto@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Isearch should store aborted search strings too
Date: Wed, 07 Dec 2011 18:45:52 +0200	[thread overview]
Message-ID: <87r50gbagf.fsf@mail.jurta.org> (raw)
In-Reply-To: <loom.20111207T160117-203@post.gmane.org> (Tom's message of "Wed,  7 Dec 2011 15:14:06 +0000 (UTC)")

> 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)))



      parent reply	other threads:[~2011-12-07 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07 15:14 Isearch should store aborted search strings too Tom
2011-12-07 16:20 ` Andreas Schwab
2011-12-07 16:28   ` Tom
2011-12-08  2:00     ` Stephen J. Turnbull
2011-12-08 15:02       ` Stefan Monnier
2011-12-07 16:45 ` Juri Linkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r50gbagf.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=adatgyujto@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.