From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: isearch and region ? Date: Tue, 7 Nov 2017 07:26:25 -0800 (PST) Message-ID: References: <53A25592-F1EF-4216-A85A-63CDDBF41A4D@gmail.com> 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 1510068617 7811 195.159.176.226 (7 Nov 2017 15:30:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Nov 2017 15:30:17 +0000 (UTC) To: Jean-Christophe Helary , emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 07 16:30:09 2017 Return-path: Envelope-to: ged-emacs-devel@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 1eC5pH-0001dM-Kv for ged-emacs-devel@m.gmane.org; Tue, 07 Nov 2017 16:30:07 +0100 Original-Received: from localhost ([::1]:53986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC5pN-0005I5-GL for ged-emacs-devel@m.gmane.org; Tue, 07 Nov 2017 10:30:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eC5lr-0002Iw-Rn for emacs-devel@gnu.org; Tue, 07 Nov 2017 10:26:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eC5ln-00031W-Cd for emacs-devel@gnu.org; Tue, 07 Nov 2017 10:26:35 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:29057) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eC5ln-00030h-3I for emacs-devel@gnu.org; Tue, 07 Nov 2017 10:26:31 -0500 Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id vA7FQRSM009967 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Nov 2017 15:26:28 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 vA7FQRpN016390 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Nov 2017 15:26:27 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 vA7FQQor015743; Tue, 7 Nov 2017 15:26:26 GMT In-Reply-To: <53A25592-F1EF-4216-A85A-63CDDBF41A4D@gmail.com> 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: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219964 Archived-At: >> isearch is incremental, so most of the region-affecting=20 >> actions would conflict with it. >=20 > But search is not incremental and does not return a region either. > It just puts point at the end of the match. I guess that's useful > when you are trying to create a region from the original point > (where you'd put the mark) to the end of the matching string, > but that's quite a limited use. Or is search designed only for > navigation in the document? What's the point having a search that > does not *find*? > > Is there a search that returns the matching string as a region? ... > I see that there are lots of isearch-yank commands, but no > isearch-kill... I responded to this already on help-gnu-emacs. You have that possibility with Isearch+, using `C-M-RET'. > On the help list, I was suggested to use C-backspace after > an isearch since the point is at the end of the match, but > that only deletes a "word" and not the full match. > > By the way, what is the status of the beginning of the > match as highlighted by isearch? It is not a mark, and > it is not point... > > You would need an isearch command that (1) marks the current > occurrence as a region, and (2) exits isearch mode so you > can affect the region with your next command. I understand that. > > On the other hand, some commands could work right out of > isearch mode, if suitably implemented: > * Deleting with Delete. > * Cutting (killing) and copying. The behavior of `isearchp-act-on-demand' (`C-M-RET', by default) in Isearch+ is arbitrary - configurable, bindable. You can have it do anything you want to the current search hit. You can also define any number of different commands that use it as their base, let-binding different actions for their purposes. Bind those commands to different keys in Isearch. End of story. You don't need to have the search hit be selected as the active region; you just need to act on it. But if, for some reason, you really wanted to activate it as the region temporarily, e.g., to leverage an existing function that acts on the region, that too is trivial to do in a function that you use as the value of `isearchp-on-demand-action-function' (which is what is used by `isearchp-act-on-demand'). As for other uses of the region wrt Isearch: Isearch+ offers these possibilities: * Set the region around the last search hit visited: option `isearchp-set-region-flag', toggle with `M-s M-SPC'. (_After_ searching you can also use command `isearchp-set-region-around-search-target' to set the region.) * Restrict search to the active region: option `isearchp-restrict-to-region-flag', toggle with `C-x n'. Vanilla Emacs has this for query-replace but not for Isearch. Restriction of searching to the active region works also for a rectangular region. * Option `isearchp-deactivate-region-flag': whether to deactivate the region during searching (e.g. for better visibility) If you use also library `isearch-prop.el' then you can use command `isearchp-put-prop-on-region' to add any text property to the region. This gives you an easy way to set up contexts for text-property search (which is provided by that library). For property `face', empty input to `isearchp-put-prop-on-region' removes all faces from the region.