From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#21957: 24.5; Make occur search within regions when there is one Date: Sun, 22 Nov 2015 17:29:26 -0800 (PST) Message-ID: <99d74c5d-0047-4d4e-970e-008bc4a12b62@default> References: <87si42sdau.fsf@ipass-lix01.i-did-not-set--mail-host-address--so-tickle-me> <87ziy9tu1m.fsf@mail.linkov.net> <56500129.9090307@itsuwa.org> <87io4t5zto.fsf@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1448242220 18132 80.91.229.3 (23 Nov 2015 01:30:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Nov 2015 01:30:20 +0000 (UTC) Cc: 21957@debbugs.gnu.org, Li Ian-Xue To: Juri Linkov , Artur Malabarba Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 23 02:30:15 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a0fxO-0005jI-AT for geb-bug-gnu-emacs@m.gmane.org; Mon, 23 Nov 2015 02:30:14 +0100 Original-Received: from localhost ([::1]:58146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0fxO-0006zc-FU for geb-bug-gnu-emacs@m.gmane.org; Sun, 22 Nov 2015 20:30:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0fxK-0006zO-6V for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 20:30:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0fxG-0002Jz-1y for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 20:30:10 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0fxF-0002J2-Ve for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 20:30:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1a0fxF-0001Pe-Bb for bug-gnu-emacs@gnu.org; Sun, 22 Nov 2015 20:30:05 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Nov 2015 01:30:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21957 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21957-submit@debbugs.gnu.org id=B21957.14482421795363 (code B ref 21957); Mon, 23 Nov 2015 01:30:04 +0000 Original-Received: (at 21957) by debbugs.gnu.org; 23 Nov 2015 01:29:39 +0000 Original-Received: from localhost ([127.0.0.1]:48688 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a0fwo-0001OP-Qu for submit@debbugs.gnu.org; Sun, 22 Nov 2015 20:29:39 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:27428) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1a0fwm-0001OH-PC for 21957@debbugs.gnu.org; Sun, 22 Nov 2015 20:29:37 -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 tAN1TY5W018002 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 23 Nov 2015 01:29:34 GMT Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id tAN1TYFh008103 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 23 Nov 2015 01:29:34 GMT Original-Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id tAN1TXLx008641; Mon, 23 Nov 2015 01:29:33 GMT In-Reply-To: <87io4t5zto.fsf@mail.linkov.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: userv0021.oracle.com [156.151.31.71] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:109111 Archived-At: > > 1. If the selected region has multiple lines, it would search only > > inside the region. > > 2. If the selected region has one line or less, it would use the > > region as the search string. > > 3. If there's no selection it do the usual occur. >=20 > This is a useful heuristic, not sure how intuitive it is. >=20 > BTW, I recall Drew asked how to do the same in Isearch, but I see no way > because in Isearch it's useful to mark the beginning of the region, and > extend it using Isearch commands by putting the end of the region where > Isearch ends. No, I don't think that was me. Or not quite, if by that you mean something I might have said about searching the region. I'm not in favor of things such as the automatic switching among #1, #2, and #3, above. I prefer to let users pick whether to search the region, regardless of its size or whether it contains a newline char. The combination of 1,2,3 above is _not_ a useful heuristic, IMO. It can be useful to do any of those things, but I don't think it is useful to couple them together in a "dwimish" way. I'm also not in favor of Isearch just picking up the region as the search string (regardless of whether it contains newlines). I prefer that users yank the region into the search string if they want to search with it. (I also give them another command ('C-M-y') to yank the secondary selection, which is typically not at point, and which doesn't change until you change it explicitly.) IOW, I think it is better to have users explicitly say what behavior they want, instead of dwimming them around. FWIW, in Isearch+ these features are related to the region: 1. Option 'isearchp-restrict-to-region-flag' restricts searching to the active region (regardless of its size or the presence of a newline). You can toggle this during Isearch using 'C-x n'. 2. Option 'isearchp-deactivate-region-flag' causes the active region to be deactivated (removing highlighting). That makes it easier to see what is being searched. 3. If you also use library `modeline-posn.el' then when you search the active region you can keep that restriction for query-replacement invoked from Isearch. 4. Non-nil option 'isearchp-set-region-flag' selects the last search target as the region when you exit Isearch. You can toggle this during Isearch using 'C-SPC'. If you also use library `replace+.el' then you can similarly select the last replacement as the region when you query-replace etc. 5. You can put a text or overlay property on the text in the region, and then later search the zones of text that have that property (they need not be contiguous). 6. If you also use library `zones.el' then you can search multiple zones defined by their limits (buffer positions or markers in any buffers), instead of by properties. You can add the active region to a set of such zones, using 'C-x n a'. You can coalesce such zones, uniting their overlaps. (That happens anyway when you search a set of zones.) 7. When you search zones of any kind, non-nil option 'isearchp-dim-non-prop-zones-flag' dims the pieces of text that are not being searched. You can toggle this during Isearch using 'C-M-D' (aka 'C-M-S-d'). 8. You can search zones defined by text/overlays/buffer limits as described above, or you can search the complement. You can toggle searching the complement using 'C-M-~' during Isearch. http://www.emacswiki.org/emacs/IsearchPlus http://www.emacswiki.org/emacs/Zones http://www.emacswiki.org/emacs/ReplacePlus http://www.emacswiki.org/emacs/ModeLinePosition