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: Thu, 29 Dec 2016 18:10:04 +0200 Message-ID: <8337h6vhr7.fsf@gnu.org> References: <87vau3jl6f.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1483027851 31309 195.159.176.226 (29 Dec 2016 16:10:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 29 Dec 2016 16:10:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tino Calancha Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 29 17:10:45 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 1cMdHr-0006nY-R2 for ged-emacs-devel@m.gmane.org; Thu, 29 Dec 2016 17:10:39 +0100 Original-Received: from localhost ([::1]:36200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMdHw-00084y-Gu for ged-emacs-devel@m.gmane.org; Thu, 29 Dec 2016 11:10:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMdHQ-00084r-7R for emacs-devel@gnu.org; Thu, 29 Dec 2016 11:10:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMdHN-000321-1b for emacs-devel@gnu.org; Thu, 29 Dec 2016 11:10:12 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:54896) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMdHM-00031v-UO; Thu, 29 Dec 2016 11:10:08 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1272 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1cMdHM-0004ps-7h; Thu, 29 Dec 2016 11:10:08 -0500 In-reply-to: <87vau3jl6f.fsf@gmail.com> (message from Tino Calancha on Thu, 29 Dec 2016 15:36:56 +0900) 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:210955 Archived-At: > From: Tino Calancha > Date: Thu, 29 Dec 2016 15:36:56 +0900 > Cc: tino.calancha@gmail.com > > Any comment about this proposal? I have one comment: > +(defun occur-in-region (regexp &optional nlines) > + "Show all lines in the active region containing a match for REGEXP. > +Each line is displayed with NLINES lines before and after, or -NLINES > +before if NLINES is negative. > +As `occur' but restricted to lines within the active region." > + (interactive (occur-read-primary-args "in region")) > + (unless (use-region-p) > + (error "Region not active")) I think our convention for functions that act on the region is to accept BEG and END arguments, so that the function could be called from Lisp. The 'interactive' form/spec should then provide these arguments for the interactive use. Also, this will need a NEWS entry, and possibly also an addition to the user manual. Thanks.