From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: killing the result of isearch Date: Mon, 6 Nov 2017 21:34:29 -0800 (PST) Message-ID: <433bd3d0-a506-4d89-9d10-dcbfb0e23be0@default> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1510032908 8225 195.159.176.226 (7 Nov 2017 05:35:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Nov 2017 05:35:08 +0000 (UTC) To: Jean-Christophe Helary , Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 07 06:35:00 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 1eBwXL-0001mB-W7 for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Nov 2017 06:35:00 +0100 Original-Received: from localhost ([::1]:51496 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBwXT-0000nw-53 for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Nov 2017 00:35:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBwX1-0000np-QD for help-gnu-emacs@gnu.org; Tue, 07 Nov 2017 00:34:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBwWy-00055V-NS for help-gnu-emacs@gnu.org; Tue, 07 Nov 2017 00:34:39 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:38282) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eBwWy-00055A-EG for help-gnu-emacs@gnu.org; Tue, 07 Nov 2017 00:34:36 -0500 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vA75YVVh030006 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Nov 2017 05:34:32 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vA75YVIL009948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Nov 2017 05:34:31 GMT Original-Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vA75YUSx021530; Tue, 7 Nov 2017 05:34:30 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4600.0 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 156.151.31.81 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:114760 Archived-At: > I must be missing something big... No, you're not. > I have an isearch that highlights a string, and I just=20 > want to delete that string. >=20 > 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+ 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