From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: Design of commands operating on rectangular regions Date: Fri, 20 Nov 2015 11:10:49 -0800 Message-ID: References: <5625B166.3080104@dancol.org> <86zizdczhp.fsf@stephe-leake.org> <871tc315y3.fsf@lifelogs.com> <83k2pvqg0l.fsf@gnu.org> <837fluqkd1.fsf@gnu.org> <87oaf1s82r.fsf@mail.linkov.net> <876116ucdm.fsf_-_@mail.linkov.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1448046695 26214 80.91.229.3 (20 Nov 2015 19:11:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Nov 2015 19:11:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 20 20:11:30 2015 Return-path: Envelope-to: ged-emacs-devel@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 1Zzr5m-0007wk-2H for ged-emacs-devel@m.gmane.org; Fri, 20 Nov 2015 20:11:30 +0100 Original-Received: from localhost ([::1]:49431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzr5l-0006QM-Kl for ged-emacs-devel@m.gmane.org; Fri, 20 Nov 2015 14:11:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzr5Q-0006Mn-S9 for emacs-devel@gnu.org; Fri, 20 Nov 2015 14:11:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zzr5N-0001ej-L1 for emacs-devel@gnu.org; Fri, 20 Nov 2015 14:11:08 -0500 Original-Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]:34206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzr5N-0001eU-Fc for emacs-devel@gnu.org; Fri, 20 Nov 2015 14:11:05 -0500 Original-Received: by padhx2 with SMTP id hx2so124690567pad.1 for ; Fri, 20 Nov 2015 11:11:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:date:message-id:references :user-agent:mail-followup-to:mime-version:content-type; bh=itKR7eLMsCWgp7OAFnJpptqUQY04Fx8ot0UDh2h8sO8=; b=BO+0Nf1Z3V1E8Qk7LRQos8Y4sIgHjd3dKoNapZIEBsdCAs2+HxCj3CaqX4uWVzjbPs XZLLhHFirocN6GBb0fIZG7xh/roYskGgQ4EfiZEBVdHAq6fJaqMOG8i0gXDqvsh4iwyx kXPSim6hs1jUn/naH6vqcHTjefpA7lwazWuwRO8dLHQM6ZAy8mQdU0VmPDtp0N4yYGXH 1+EM26Aq5mNdHjdaQcjZqpZTZzR1EJ6uZptj/yJUDJjMJ/NCjtVrsfdHGRtir2h4YNXB K7umhEbd2Lg+JTcjf1AkG5T+CKwamzst5MjEUTCh/OfodEtPfvCG/Tfz4HPT72V0+d36 WYpw== X-Received: by 10.66.190.66 with SMTP id go2mr21718515pac.114.1448046664736; Fri, 20 Nov 2015 11:11:04 -0800 (PST) Original-Received: from Vulcan.local (76-234-68-79.lightspeed.frokca.sbcglobal.net. [76.234.68.79]) by smtp.gmail.com with ESMTPSA id ce3sm704695pbb.35.2015.11.20.11.11.02 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 20 Nov 2015 11:11:02 -0800 (PST) X-Google-Original-From: "John Wiegley" Original-Received: by Vulcan.local (Postfix, from userid 501) id 0778510A59FCA; Fri, 20 Nov 2015 11:11:02 -0800 (PST) In-Reply-To: <876116ucdm.fsf_-_@mail.linkov.net> (Juri Linkov's message of "Thu, 12 Nov 2015 23:38:29 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Mail-Followup-To: Juri Linkov , emacs-devel@gnu.org X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::230 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:194883 Archived-At: >>>>> Juri Linkov writes: > (defun shell-command-on-region (start end command > &optional output-buffer replace > - error-buffer display-error-buffer) > + error-buffer display-error-buffer > + region-noncontiguous-p) > "Execute string COMMAND in inferior shell with region as input. Juri, Can you tell me more about the meaning of `region-noncontiguous-p' here? How does the caller know when this option is required? My takeaway is that this patch conflates user-level indications (selected regions) too closely with the programmatically provided entities (the region specified by START END). Perhaps it points to the need for an `interactive' specifier to request "the current region, though if multiple sub-regions exist, the set of spans indicated by those sub-regions". A function like `shell-command-on-region' should be determined by its arguments. This patch introduces a much tighter coupling with its context of use than what we had previously. To make that last statement clearer: Right now, `shell-command-on-region' acts on a buffer, and a region of text within that buffer. This region is provided to the command through its arguments by (interactive "r"). The only thing that `shell-command-on-region' needs to do beyond that is to query the current buffer, in order to feed text to the executed process. So, our "context" is the current buffer, while everything else is provided by its arguments. Your patch introduces a more hybridized behavior: (interactive "r") provides the total extent of the region, but now there's an additional parameter, `region-noncontiguous-p', that alters the behavior of shell-command-on-region so that it pays attention not only to the current buffer, but also to user-specified regions when drawing text from the buffer. And these regions are only somewhat related to the region provided by "interactive 'r'". I feel that the semantic "level" of these three arguments -- START, END and REGION-NONCONTIGUOUS-P -- are now different, which I find confusing. `region-noncontiguous-p' doesn't relate to the `interactive' form at all, but rather solely to this new behavior, internal to shell-command-on-region. I'd really like to solve this in a different manner for 25.1. John