emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] (Or "question"...) isearch-kill-found


From: Stefan Monnier
Subject: Re: [PATCH] (Or "question"...) isearch-kill-found
Date: Mon, 31 May 2010 11:54:38 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> A command to delete the current match without exiting isearch
>> would be more useful.  It will allow to continue searching for the
>> next matches and delete them too:
>> (define-key isearch-mode-map [delete] 'isearch-delete-current-match)
>> (defun isearch-delete-current-match ()
>>   "Kills the region that isearch has found."
>>   (interactive)
>>   (kill-region isearch-other-end (point)))

> I think this is a good idea, since [delete] isn't currently used.  Maybe
> add C-d also.

Every new key we use tends to collide with its current use of "exit
isearch and run the command globally bound to that key".  I.e. people
who currently expect C-d/delete to exit isearch and delete the next char
will be badly surprised.

Now, I haven't heard a proposal yet that doesn't suffer from this kind
of problem, but I think that using a new key should only be done if
there's a good chance that it's very rarely used (C-d might not be very
frequently used to exit isearch, but there's no reason to think it's
rarely used either) *and* if the new functionality is
sufficiently important.  In my experience deleting the matched text is
not that frequent a need.  Yes, I also do it every once in a while, but
I also often want to delete something slightly different.  Or I want to
do something else with it.

So I'd much rather see an "exit and set the mark at isearch-other-end"
command, after which you can do C-w if you want to delete that text (I
could also imagine a "set the mark isearch-other-end but don't exit",
but then deleting the text would require RET C-w instead).

Richard thinks that C-SPC C-r C-r works as well, but for regexp-patterns
it won't always match the same text, and I must say that C-SPC C-r C-r
RET C-w is pretty long winded.  Still, if we want a new
isearch-set-mark-and-exit, we'll need to find a good keybinding for it.
I'm not sure C-SPC is a good choice (OT1H it's pretty common to use
C-SPC to exit isearch, so many uses will be affected, OTOH it will
behave in a similar way, just pushing the mark at the other end of the
search).  Of course, we could provide the command without binding it,
like we've done with isearch-toggle-case-fold, isearch-toggle-regexp and
a few others.


        Stefan



reply via email to

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