From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [patch] Run occur command restricted to a region Date: Sat, 31 Dec 2016 10:37:55 +0200 Message-ID: <831swoijdo.fsf@gnu.org> References: <87vau3jl6f.fsf@gmail.com> <87shp6uwvj.fsf@mail.linkov.net> <83h95lua2f.fsf@gnu.org> <878tqxm1wh.fsf@mail.linkov.net> Reply-To: Eli Zaretskii 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 1483173505 18930 195.159.176.226 (31 Dec 2016 08:38:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 31 Dec 2016 08:38:25 +0000 (UTC) Cc: emacs-devel@gnu.org, tino.calancha@gmail.com To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 31 09:38:12 2016 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 1cNFAz-0002JN-VV for ged-emacs-devel@m.gmane.org; Sat, 31 Dec 2016 09:38:06 +0100 Original-Received: from localhost ([::1]:42979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNFB3-0002gF-4q for ged-emacs-devel@m.gmane.org; Sat, 31 Dec 2016 03:38:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNFAx-0002g7-7z for emacs-devel@gnu.org; Sat, 31 Dec 2016 03:38:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNFAt-0007I3-Ad for emacs-devel@gnu.org; Sat, 31 Dec 2016 03:38:03 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43497) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNFAt-0007HG-7a; Sat, 31 Dec 2016 03:37:59 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3896 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cNFAo-00065y-Q9; Sat, 31 Dec 2016 03:37:55 -0500 In-reply-to: <878tqxm1wh.fsf@mail.linkov.net> (message from Juri Linkov on Sat, 31 Dec 2016 01:16:34 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:211017 Archived-At: > From: Juri Linkov > Cc: tino.calancha@gmail.com, emacs-devel@gnu.org > Date: Sat, 31 Dec 2016 01:16:34 +0200 > > >> > 1) occur-backward: for lines before the current one. > >> > >> The name occur-backward falsely implies it uses re-search-backward, > >> and I'm unsure if we need it as a counter part of isearch-backward. > > > > I can suggest occur-before and occur-after instead. > > Or occur-above and occur-below. > > What causes the doubt is that there are no other commands like that. > No ‘count-words-before’, no ‘count-words-above’, just ‘count-words-region’ > no ‘comment-before’, no ‘comment-above’, just ‘comment-region’, > no ‘delete-before’, no ‘delete-above’, just ‘delete-region’, > and tens of other similar commands. This command emulates Grep, with its -A and -B options. That's why I suggested "after" and "before". No other command need to show context, so it's quite understandable why this one is unique in that sense. > This means that it's simple enough to select the region (e.g. ‘M-<’ > to the beginning of the buffer) and use ‘*-region’ commands to > operate on the active region. So it should be enough to handle the > active region in ‘occur’ without creating new commands. The problem is that the meaning of the region here says nothing about the context lines the user wants displayed in the Occur buffer. I agree that an active region should mean "find matches in that region", but we still need a way for the user to specify non-default number of context lines to show with the matches, I think.