From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Region argument Date: Wed, 04 Jan 2017 02:57:08 +0200 Organization: LINKOV.NET Message-ID: <87y3yr60y8.fsf@mail.linkov.net> References: <87vau3jl6f.fsf@gmail.com> <8337h6vhr7.fsf@gnu.org> <83a8b8f0wp.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1483495259 26345 195.159.176.226 (4 Jan 2017 02:00:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2017 02:00:59 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (x86_64-pc-linux-gnu) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 04 03:00:56 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 1cOasl-0005Mc-1U for ged-emacs-devel@m.gmane.org; Wed, 04 Jan 2017 03:00:51 +0100 Original-Received: from localhost ([::1]:36912 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOasm-0004Wv-3i for ged-emacs-devel@m.gmane.org; Tue, 03 Jan 2017 21:00:52 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOasf-0004Wm-If for emacs-devel@gnu.org; Tue, 03 Jan 2017 21:00:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOasc-0001g6-Dh for emacs-devel@gnu.org; Tue, 03 Jan 2017 21:00:45 -0500 Original-Received: from hapkido.dreamhost.com ([66.33.216.122]:54634) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cOasb-0001d0-RD for emacs-devel@gnu.org; Tue, 03 Jan 2017 21:00:42 -0500 Original-Received: from homiemail-a75.g.dreamhost.com (sub3.mail.dreamhost.com [69.163.253.7]) by hapkido.dreamhost.com (Postfix) with ESMTP id 61FA79CAA0 for ; Tue, 3 Jan 2017 18:00:35 -0800 (PST) Original-Received: from homiemail-a75.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTP id 67E6C5EC079; Tue, 3 Jan 2017 18:00:33 -0800 (PST) Original-Received: from localhost.linkov.net (m83-179-248-12.cust.tele2.ee [83.179.248.12]) (Authenticated sender: jurta@jurta.org) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTPA id 994465EC072; Tue, 3 Jan 2017 18:00:32 -0800 (PST) In-Reply-To: (Stefan Monnier's message of "Tue, 03 Jan 2017 13:59:46 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 66.33.216.122 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:211095 Archived-At: >> We could start by having Someone=E2=84=A2 "in the know" (hint, hint) d= escribe >> the new conventions in the ELisp manual. > > I remember we discussed a new convention, but I'm not sure if we did en= d > up implementing one. IIRC, the missing piece is just a small function: (defun region () (funcall region-extract-function 'bounds)) to provide all info including former region-beginning and region-end for ordinary regions as well as a list of boundaries in case of rectangular regions. Then it could be used in the interactive spec: (defun occur (regexp &optional nlines region) (interactive (nconc (occur-read-primary-args) (list (and (use-region-p) (region))))) (occur-1 regexp nlines (list (current-buffer)))) Here nconc for occur-read-primary-args complicates the issue a little, but in the general case what is needed is only (interactive (list (and (use-region-p) (region))))