all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Isearch should store aborted search strings too
@ 2011-12-07 15:14 Tom
  2011-12-07 16:20 ` Andreas Schwab
  2011-12-07 16:45 ` Juri Linkov
  0 siblings, 2 replies; 6+ messages in thread
From: Tom @ 2011-12-07 15:14 UTC (permalink / raw)
  To: emacs-devel

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.

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.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Isearch should store aborted search strings too
  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-07 16:45 ` Juri Linkov
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2011-12-07 16:20 UTC (permalink / raw)
  To: Tom; +Cc: emacs-devel

Tom <adatgyujto@gmail.com> writes:

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

Alternative: type RET and then C-u C-SPC.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Isearch should store aborted search strings too
  2011-12-07 16:20 ` Andreas Schwab
@ 2011-12-07 16:28   ` Tom
  2011-12-08  2:00     ` Stephen J. Turnbull
  0 siblings, 1 reply; 6+ messages in thread
From: Tom @ 2011-12-07 16:28 UTC (permalink / raw)
  To: emacs-devel

Andreas Schwab <schwab <at> linux-m68k.org> writes:

> 
> Tom <adatgyujto <at> gmail.com> writes:
> 
> > 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.
> 
> Alternative: type RET and then C-u C-SPC.
> 

Yes, but it's much more typing than a simple C-g which is not a good thing
in case of a frequent operation. I use isearch quite a lot to move around
in buffers.

As a workaround I added an advice which forces isearch to always store
the search string:

(defadvice isearch-done (before my-isearch-done activate)
  (ad-set-arg 0 nil))


With this anyone can try it how it feels in practice. I find it
quite convenient that I can quickly repeat an isearch with
C-s C-s regardless if I exited the search normally or aborted it.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Isearch should store aborted search strings too
  2011-12-07 15:14 Isearch should store aborted search strings too Tom
  2011-12-07 16:20 ` Andreas Schwab
@ 2011-12-07 16:45 ` Juri Linkov
  1 sibling, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2011-12-07 16:45 UTC (permalink / raw)
  To: Tom; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Isearch should store aborted search strings too
  2011-12-07 16:28   ` Tom
@ 2011-12-08  2:00     ` Stephen J. Turnbull
  2011-12-08 15:02       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen J. Turnbull @ 2011-12-08  2:00 UTC (permalink / raw)
  To: Tom; +Cc: emacs-devel

I forget the exact details, but XEmacs stores some fraction (maybe
100%, as I say, I forget the details) of the successful portion of
aborted searches.  I miss this when I use Emacs.

On the other hand, it's really not good enough.  XEmacs doesn't permit
editing of the searched string once it's been recalled with C-s C-s,
and I find that such aborted strings often want variation for the next
such search, much more often than with search-and-stay-where-found
operations.  (If Emacs already permits editing of the recalled string,
then I would consider that a big improvement over our style, and give
a "big +1" to the proposed change.)





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Isearch should store aborted search strings too
  2011-12-08  2:00     ` Stephen J. Turnbull
@ 2011-12-08 15:02       ` Stefan Monnier
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2011-12-08 15:02 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: Tom, emacs-devel

> I forget the exact details, but XEmacs stores some fraction (maybe
> 100%, as I say, I forget the details) of the successful portion of
> aborted searches.  I miss this when I use Emacs.

That's an interesting idea.  I think for my use case, both "store the
aborted search string" and "store the successful part of the aborted
search" would work fine and would be an improvement over the
current situation.

> On the other hand, it's really not good enough.  XEmacs doesn't permit
> editing of the searched string once it's been recalled with C-s C-s,

Emacs does not allow editing it via DEL (tho I use a local patch that
does), but it can still be edited via M-e.


        Stefan



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-12-08 15:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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.