From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Loris Bennett" Newsgroups: gmane.emacs.help Subject: Re: killing the result of isearch Date: Tue, 07 Nov 2017 08:07:54 +0100 Organization: ZEDAT, Freie =?utf-8?Q?Universit=C3=A4t?= Berlin Message-ID: <87r2tava5x.fsf@hornfels.zedat.fu-berlin.de> References: <433bd3d0-a506-4d89-9d10-dcbfb0e23be0@default> <852BAA28-2A50-4AD9-B8D6-9F06905A4395@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1510038626 20051 195.159.176.226 (7 Nov 2017 07:10:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Nov 2017 07:10:26 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 07 08:10:22 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBy1e-00050J-0N for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Nov 2017 08:10:22 +0100 Original-Received: from localhost ([::1]:51698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBy1l-0003NI-0L for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Nov 2017 02:10:29 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 95 Original-X-Trace: news.uni-berlin.de bBdvu6h3mBxiSnCaPMMiUw2k8ZQBnkTXYhewSRBMqdnua6 Cancel-Lock: sha1:8Jqx1JIavyO8DEgguva/p4BsWUE= Original-Xref: usenet.stanford.edu gnu.emacs.help:220656 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114764 Archived-At: Søren Pilgård writes: > On Nov 7, 2017 7:04 AM, "Jean-Christophe Helary" < > jean.christophe.helary@gmail.com> wrote: > > > >> On Nov 7, 2017, at 14:34, Drew Adams wrote: >> >>> I must be missing something big... >> >> No, you're not. > > I'm not sure that makes me feel better... But that you very much for the > thorough reply. > >>> I have an isearch that highlights a string, and I just want to delete > that string. >>> >>> In other editors I'd just hit delete on that selection, but that won't > work in emacs... >> >> Not in vanilla Emacs, no; it won't work. > >> If you use Isearch+ > > Is there a way to emulate that in vanilla emacs? > Well, I guess yes, by creating the adequate function, etc. > > But, isn't it something emacs users do normally? Search for a string and > just delete it? Doesn't it look like a function that could be useful in > vanilla emacs? I can sort of imagine that such a function might be useful, but in several decades of using Emacs, both writing code and prose, I've honestly never missed it. What is your use case? The closest I come is search and replace, so you could just replace with an empty string. However, searching and then doing 'C-backspace' deletes the word found on my system. Cheers, Loris > Jean-Christophe > >> then you can hit `C-M-RET' to delete the >> search hit. (The current search hit is not the "selection", >> BTW, in the sense of being the Emacs region.) >> >> [If you prefer that the key for this be, say, the `' >> key, then just bind command `isearchp-act-on-demand' to >> `(kbd "")' in `isearch-mode-map'.] >> >> With Isearch+, `C-M-RET' performs an action on the current >> search hit. By default, the action is to replace it with >> some replacement text. And by default that replacement >> text is empty (""), i.e., the search hit is deleted. >> >> The value of option `isearchp-on-demand-action-function' >> is the function that acts on the current search hit, which >> it is passed when you hit `C-M-RET', along with the buffer >> start and end positions of the search hit. >> >> After applying the action, search moves to the next hit in >> the same search direction, so just repeating `C-M-RET' >> carries out the action on subsequent hits. >> >> With a prefix argument, `C-M-RET' prompts for the >> replacement text, which is used thereafter until you again >> use a prefix arg. (Again, no prefix arg means empty >> replacement text, i.e., deletion.) >> >> Since you can use a prefix arg at any time, you can >> provide different replacements for different search hits >> corresponding to the same search pattern. >> >> [To use a prefix arg within Isearch, you must set >> `isearch-allow-prefix' to non-`nil'.] >> >> There's more you can do with it. See here: >> >> https://www.emacswiki.org/emacs/IsearchPlus#isearchp-act-on-demand >> > > Jean-Christophe Helary > ----------------------------------------------- > @brandelune http://mac4translators.blogspot.com > > > You could just use the query-replace functionality with an empty string. -- Dr. Loris Bennett (Mr.) ZEDAT, Freie Universität Berlin Email loris.bennett@fu-berlin.de