help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: killing the result of isearch


From: Eric Abrahamsen
Subject: Re: killing the result of isearch
Date: Tue, 07 Nov 2017 08:53:40 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:

>> On Nov 8, 2017, at 0:26, Drew Adams <drew.adams@oracle.com> wrote:
>> 
>>>> So doesn't searching-and-replace with an empty replacement work?
>>> 
>>> It works to accomplish the same result but it takes many more step as I
>>> wrote earlier:
>>> 
>>> isearch string
>>> isearch-query-replace
>>> (replace with nothing)
>> ...
>>> The problem with emacs and searches, is that you only search, you don't
>>> *find*, as in the action of searching does not result in an object that you
>>> can act upon. Which defeats the purpose of searching.
>> 
>> It does result in an object you can act upon, if you want
>> that.
>
> Would you mind being more specific ?
>
> I have no problem using new libraries, but I want to understand why I
> am missing what I think I am missing. If I understood searches
> (isearches ?) better, maybe I would not have my questions.
>
>> Q-r is nice, and it's good you can invoke it from Isearch,
>> but it is not the same thing as on-demand replacement
>> during search.
>
> Exactly.

Several years ago, when I wanted to do this, I wrote the following:

(define-key isearch-mode-map (kbd "M-m") 'my-isearch-mark-search-as-region)
(defun my-isearch-mark-search-as-region ()
  (interactive)
  (if (not isearch-mode)
      (message "This is only useful during isearch")
    (isearch-exit)
    (push-mark isearch-other-end)
    (activate-mark)))

I guess that's just a tiny half-step in the direction that isearch+ is
headed.

Another very good facility to get comfortable with is recursive editing:
type "C-r" during search mode, do whatever editing you like, then
"C-M-c" to go back into search mode.

I think what people are trying to say is that Emacs' defaults can often
seem lacking, but it makes up for it by giving you enormous power to
create your ideal behavior yourself. I think this is probably born of
decades of strong personalities, wildly varying "ideal behavior", and a
distaste for bikeshedding. I think we all expect that we need to go the
last half-mile ourselves.

Eric




reply via email to

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