From debbugs-submit-bounces@debbugs.gnu.org Thu May 21 18:04:48 2015 Received: (at submit) by debbugs.gnu.org; 21 May 2015 22:04:48 +0000 Received: from localhost ([127.0.0.1]:52424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YvYa7-0002jn-Lh for submit@debbugs.gnu.org; Thu, 21 May 2015 18:04:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48650) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YvYa5-0002jY-0t for submit@debbugs.gnu.org; Thu, 21 May 2015 18:04:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvYZz-0000cH-5I for submit@debbugs.gnu.org; Thu, 21 May 2015 18:04:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, TVD_SPACE_RATIO,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvYZz-0000cD-2r for submit@debbugs.gnu.org; Thu, 21 May 2015 18:04:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvYZy-0004Yr-B5 for bug-gnu-emacs@gnu.org; Thu, 21 May 2015 18:04:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvYZt-0000b7-5Q for bug-gnu-emacs@gnu.org; Thu, 21 May 2015 18:04:38 -0400 Received: from resqmta-ch2-01v.sys.comcast.net ([69.252.207.33]:43853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvYZs-0000an-Vn for bug-gnu-emacs@gnu.org; Thu, 21 May 2015 18:04:33 -0400 Received: from resomta-ch2-15v.sys.comcast.net ([69.252.207.111]) by resqmta-ch2-01v.sys.comcast.net with comcast id Wm4W1q00G2Qkjl901m4W6u; Thu, 21 May 2015 22:04:30 +0000 Received: from resmail-ch2-511v.sys.comcast.net ([162.150.50.35]) by resomta-ch2-15v.sys.comcast.net with comcast id Wm4W1q00V0lZslN01m4Why; Thu, 21 May 2015 22:04:30 +0000 Date: Thu, 21 May 2015 22:04:30 +0000 (UTC) From: asparagus@comcast.net To: bug-gnu-emacs@gnu.org Message-ID: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> In-Reply-To: <1119163948.10099018.1432245074823.JavaMail.zimbra@comcast.net> Subject: Wishlist: M-x shell-command-on-rectangle-region MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [::ffff:67.128.198.190] X-Mailer: Zimbra 8.0.7_GA_6031 (ZimbraWebClient - FF38 (Linux)/8.0.7_GA_6031) Thread-Topic: Wishlist: M-x shell-command-on-rectangle-region Thread-Index: jwMC0VOxHfLXOaa0WDVgG20tV1TqUg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1432245870; bh=kkt0ty8sRNgKHM/4nCdBeuwtGBUvQyyo1PG4iMmwl1g=; h=Received:Received:Date:From:To:Message-ID:Subject:MIME-Version: Content-Type; b=NpsrTtxwiMXD3NVpxGXtW3rjeYI8NRf+58c91kTlwn2LBu8qJGyhzd5aKMnYLRfwL DMY7vf8ljUnw4WuHdTKSXLaLHJ4UnoecNdNjMrGTxYDU8vs0P59PGkAbFlFzNQJ3wE W6SBwCtNFGp5DgHegyH8WkMB+GJ+UMpxuwUp3AzL2EUZttE8xFMuM2koQPgUsdnRCn E2+jc6K3h9P06U3wWWRuXS2+B36bl48QzEm/f91V+MF9M+/46HH+BeCO/qxfiWd7Rn EBt8QU5alSyGpEBAiENA8A2tY4uWcHRChH5jKC3Sp2ZStIXYoZ0E7q5i78hZJzDmER TjsyVUcao+gBg== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.3 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) Wishlist: M-x shell-command-on-rectangle-region From debbugs-submit-bounces@debbugs.gnu.org Thu May 21 18:50:33 2015 Received: (at 20626) by debbugs.gnu.org; 21 May 2015 22:50:33 +0000 Received: from localhost ([127.0.0.1]:52443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YvZIO-0005il-RX for submit@debbugs.gnu.org; Thu, 21 May 2015 18:50:33 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:53804 helo=homiemail-a11.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YvZIL-0005iS-4X for 20626@debbugs.gnu.org; Thu, 21 May 2015 18:50:30 -0400 Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id 27F4D6E07C; Thu, 21 May 2015 15:50:28 -0700 (PDT) Received: from localhost.linkov.net (82.131.88.134.cable.starman.ee [82.131.88.134]) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPA id 544CA6E076; Thu, 21 May 2015 15:50:27 -0700 (PDT) From: Juri Linkov To: asparagus@comcast.net Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Organization: LINKOV.NET References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> Date: Fri, 22 May 2015 01:47:52 +0300 In-Reply-To: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> (asparagus@comcast.net's message of "Thu, 21 May 2015 22:04:30 +0000 (UTC)") Message-ID: <87twv51raf.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > Wishlist: > M-x shell-command-on-rectangle-region As you can see in bug#20070, the effort to make commands rectangleable had stalled some time ago due to the need to decide how to handle backward-compatibility of the existing region arguments, e.g. in (shell-command-on-region START END COMMAND &optional OUTPUT-BUFFER REPLACE ERROR-BUFFER DISPLAY-ERROR-BUFFER) how to send the boundaries of the rectangular region in START and END. One idea is to handle it like recently we handled backward-compatibility for saving dired positions in saveplace.el where we used a new format like ("~" (dired-filename . "~/.emacs.d/places")) Using something like this means sending the rectangular bounds either in START or END in the new format like (rect (1 . 2) (3 . 4)) From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 15 17:46:12 2015 Received: (at 20626) by debbugs.gnu.org; 15 Jun 2015 21:46:12 +0000 Received: from localhost ([127.0.0.1]:55023 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4cCo-0008IU-K3 for submit@debbugs.gnu.org; Mon, 15 Jun 2015 17:46:11 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:32836 helo=homiemail-a101.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z4cCk-0008IA-5V for 20626@debbugs.gnu.org; Mon, 15 Jun 2015 17:46:07 -0400 Received: from homiemail-a101.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a101.g.dreamhost.com (Postfix) with ESMTP id 75907117E06C; Mon, 15 Jun 2015 14:46:04 -0700 (PDT) Received: from localhost.linkov.net (m213-102-82-211.cust.tele2.ee [213.102.82.211]) (Authenticated sender: jurta@jurta.org) by homiemail-a101.g.dreamhost.com (Postfix) with ESMTPA id 683D1117E06A; Mon, 15 Jun 2015 14:46:02 -0700 (PDT) From: Juri Linkov To: asparagus@comcast.net Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Organization: LINKOV.NET References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> Date: Tue, 16 Jun 2015 00:45:27 +0300 In-Reply-To: <87twv51raf.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 22 May 2015 01:47:52 +0300") Message-ID: <87fv5s4pm0.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) >> Wishlist: >> M-x shell-command-on-rectangle-region > > As you can see in bug#20070, the effort to make commands rectangleable > had stalled some time ago due to the need to decide how to handle > backward-compatibility of the existing region arguments, e.g. in > > (shell-command-on-region START END COMMAND &optional OUTPUT-BUFFER REPLACE > ERROR-BUFFER DISPLAY-ERROR-BUFFER) > > how to send the boundaries of the rectangular region in START and END. > > One idea is to handle it like recently we handled backward-compatibility > for saving dired positions in saveplace.el where we used a new format like > > ("~" (dired-filename . "~/.emacs.d/places")) > > Using something like this means sending the rectangular bounds > either in START or END in the new format like > > (rect (1 . 2) (3 . 4)) Sorry, I was wrong. I realized now that query-replace has quite a different requirement. query-replace needs rectangular boundaries to limit the search for replacements, whereas shell-command-on-region should extract the rectangular region as strings and replace it with the result of the command. Here is a working prototype that demonstrates its possible implementation: (define-advice shell-command-on-region (:around (orig-fun start end command &optional output-buffer replace error-buffer display-error-buffer)) (if (and (boundp 'rectangle-mark-mode) rectangle-mark-mode) (let ((input (mapconcat 'identity (delete-extract-rectangle start end) "\n")) output) (with-temp-buffer (insert input) (call-process-region (point-min) (point-max) shell-file-name t t nil shell-command-switch command) (setq output (split-string (buffer-string) "\n"))) (goto-char start) (insert-rectangle output)) (funcall orig-fun start end command output-buffer replace error-buffer display-error-buffer))) This is another case to take into account when designing the interface, i.e. in this case the list of boundaries in the arg START is not necessary, and I have no idea how to avoid `(if (and (boundp 'rectangle-mark-mode) rectangle-mark-mode))' From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 22 18:40:13 2015 Received: (at 20626) by debbugs.gnu.org; 22 Jun 2015 22:40:13 +0000 Received: from localhost ([127.0.0.1]:54754 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7ANw-0000vu-05 for submit@debbugs.gnu.org; Mon, 22 Jun 2015 18:40:12 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:35472 helo=homiemail-a19.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7ANg-0000v0-TZ for 20626@debbugs.gnu.org; Mon, 22 Jun 2015 18:39:57 -0400 Received: from homiemail-a19.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTP id 5F273604089; Mon, 22 Jun 2015 15:39:56 -0700 (PDT) Received: from localhost.linkov.net (m213-102-70-120.cust.tele2.ee [213.102.70.120]) (Authenticated sender: jurta@jurta.org) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTPA id 6A4AE60405D; Mon, 22 Jun 2015 15:39:55 -0700 (PDT) From: Juri Linkov To: asparagus@comcast.net Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Organization: LINKOV.NET References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> Date: Tue, 23 Jun 2015 01:37:53 +0300 In-Reply-To: <87fv5s4pm0.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 16 Jun 2015 00:45:27 +0300") Message-ID: <874mlzweri.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > Sorry, I was wrong. I realized now that query-replace has quite > a different requirement. query-replace needs rectangular boundaries > to limit the search for replacements, whereas shell-command-on-region > should extract the rectangular region as strings and replace it with > the result of the command. Here is a working prototype that demonstrat= es > its possible implementation: > > (define-advice shell-command-on-region > (:around (orig-fun start end command > &optional output-buffer replace > error-buffer display-error-buffer)) > (if (and (boundp 'rectangle-mark-mode) rectangle-mark-mode) > (let ((input (mapconcat 'identity (delete-extract-rectangle start= end) "\n")) > output) > (with-temp-buffer > (insert input) > (call-process-region (point-min) (point-max) > shell-file-name t t > nil shell-command-switch > command) > (setq output (split-string (buffer-string) "\n"))) > (goto-char start) > (insert-rectangle output)) > (funcall orig-fun start end command > output-buffer replace > error-buffer display-error-buffer))) > > This is another case to take into account when designing the interface, > i.e. in this case the list of boundaries in the arg START is not necess= ary, > and I have no idea how to avoid `(if (and (boundp 'rectangle-mark-mode) > rectangle-mark-mode))' For example, the command =E2=80=98kill-ring-save=E2=80=99 has the signatu= re kill-ring-save (beg end &optional region) with an additional boolean arg for the region. And =E2=80=98rectangle--extract-region=E2=80=99 contains a condition that checks for =E2=80=98rectangle-mark-mode=E2=80=99. Combining these two prerequisites we could do a similar thing in =E2=80=98shell-command-on-region=E2=80=99 by adding a new arg and using i= t in the function body: diff --git a/lisp/simple.el b/lisp/simple.el index 1868077..d022504 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3274,7 +3278,8 @@ =20 (defun shell-command-on-region (start end command &optional output-buffer replace - error-buffer display-error-buffer) + error-buffer display-error-buffer + region) "Execute string COMMAND in inferior shell with region as input. Normally display output (if any) in temp buffer `*Shell Command Output*'= ; Prefix arg means replace the region with it. Return the exit code of @@ -3337,7 +3342,8 @@ (defun shell-command-on-region (start end command current-prefix-arg current-prefix-arg shell-command-default-error-buffer - t))) + t + rectangle-mark-mode))) (let ((error-file (if error-buffer (make-temp-file @@ -3346,6 +3352,18 @@ (defun shell-command-on-region (start end command temporary-file-directory))) nil)) exit-status) + (if region + (let ((input (mapconcat 'identity (delete-extract-rectangle star= t end) "\n")) + output) + (with-temp-buffer + (insert input) + (call-process-region (point-min) (point-max) + shell-file-name t t + nil shell-command-switch + command) + (setq output (split-string (buffer-string) "\n"))) + (goto-char start) + (insert-rectangle output)) (if (or replace (and output-buffer (not (or (bufferp output-buffer) (stringp output-buffer))))) @@ -3435,7 +3453,7 @@ (defun shell-command-on-region (start end command exit-status output)))) ;; Don't kill: there might be useful info in the undo-log. ;; (kill-buffer buffer) - )))) + ))))) =20 (when (and error-file (file-exists-p error-file)) (if (< 0 (nth 7 (file-attributes error-file))) From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 22 22:02:44 2015 Received: (at 20626) by debbugs.gnu.org; 23 Jun 2015 02:02:44 +0000 Received: from localhost ([127.0.0.1]:54792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7DXv-0005hN-HL for submit@debbugs.gnu.org; Mon, 22 Jun 2015 22:02:44 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:62323) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7DXr-0005h4-Go for 20626@debbugs.gnu.org; Mon, 22 Jun 2015 22:02:40 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A1FgA731xV/7fp92hcgxCEAoVVu0CEfoJNBAICgTw7EgEBAQEBAQGBCkEFg10BAQRWIxALNBIUGA0kiD/PIwEBAQEBAQQBAQEBHos6hQUHhC0FmW2Bd4NGlVojhBQigngBAQE X-IPAS-Result: A0A1FgA731xV/7fp92hcgxCEAoVVu0CEfoJNBAICgTw7EgEBAQEBAQGBCkEFg10BAQRWIxALNBIUGA0kiD/PIwEBAQEBAQQBAQEBHos6hQUHhC0FmW2Bd4NGlVojhBQigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="128021843" Received: from 104-247-233-183.cpe.teksavvy.com (HELO ceviche.home) ([104.247.233.183]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Jun 2015 22:02:33 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 50B55660FA; Mon, 22 Jun 2015 22:02:33 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Message-ID: References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> Date: Mon, 22 Jun 2015 22:02:33 -0400 In-Reply-To: <874mlzweri.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 23 Jun 2015 01:37:53 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > (defun shell-command-on-region (start end command > &optional output-buffer replace > - error-buffer display-error-buffer) > + error-buffer display-error-buffer > + region) > "Execute string COMMAND in inferior shell with region as input. > Normally display output (if any) in temp buffer `*Shell Command Output*'; > Prefix arg means replace the region with it. Return the exit code of > @@ -3337,7 +3342,8 @@ (defun shell-command-on-region (start end command > current-prefix-arg > current-prefix-arg > shell-command-default-error-buffer > - t))) > + t > + rectangle-mark-mode))) Doesn't make sense: if the value determine the use of rectangles, the arg shouldn't be called `region' but something like `rectangle'. Notice how kill-ring-save takes a `region' argument and doesn't have any rectangle-specific code. I still believe that shell-command-on-region should not have rectangle-specific code. The current `region-extract-function' does let you extract the region (rectangular or not) in order to pass it to a shell command. So you don't need any rectangle-specific code for that part of shell-command-on-region. OTOH There is indeed some functionality missing there to let you insert the output in a rectangular way (whatever that means). Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 23 19:03:34 2015 Received: (at 20626) by debbugs.gnu.org; 23 Jun 2015 23:03:34 +0000 Received: from localhost ([127.0.0.1]:55638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7XE6-0007wq-6K for submit@debbugs.gnu.org; Tue, 23 Jun 2015 19:03:34 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:49443 helo=homiemail-a75.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7XE4-0007wi-2u for 20626@debbugs.gnu.org; Tue, 23 Jun 2015 19:03:33 -0400 Received: from homiemail-a75.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTP id 252CF5EC082; Tue, 23 Jun 2015 16:03:31 -0700 (PDT) Received: from localhost.linkov.net (m83-191-167-128.cust.tele2.ee [83.191.167.128]) (Authenticated sender: jurta@jurta.org) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTPA id B81E15EC081; Tue, 23 Jun 2015 16:03:29 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Organization: LINKOV.NET References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> Date: Wed, 24 Jun 2015 01:59:10 +0300 In-Reply-To: (Stefan Monnier's message of "Mon, 22 Jun 2015 22:02:33 -0400") Message-ID: <87k2uuc9mx.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > I still believe that shell-command-on-region should not have > rectangle-specific code. The current `region-extract-function' does le= t > you extract the region (rectangular or not) in order to pass it to > a shell command. So you don't need any rectangle-specific code for tha= t > part of shell-command-on-region. > OTOH There is indeed some functionality missing there to let you insert > the output in a rectangular way (whatever that means). =E2=80=98shell-command-on-region=E2=80=99 currently relies on the call to (call-process-region start end shell-file-name replace ... but I'm not sure if =E2=80=98call-process-region=E2=80=99 is not too low = level to handle rectangular regions. Otherwise, there should be a condition in =E2=80=98shell-command-on-region=E2=80=99 to check for a rectangular r= egion and insert the output accordingly, so I see no way to avoid checking for =E2=80=98rectangle-mark-mode=E2=80=99 in =E2=80=98shell-command-on-region= =E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 23 19:50:28 2015 Received: (at 20626) by debbugs.gnu.org; 23 Jun 2015 23:50:28 +0000 Received: from localhost ([127.0.0.1]:55658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7XxU-0000aP-0S for submit@debbugs.gnu.org; Tue, 23 Jun 2015 19:50:28 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:52675) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7XxR-0000aH-Jq for 20626@debbugs.gnu.org; Tue, 23 Jun 2015 19:50:25 -0400 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t5NNoMRR015538; Tue, 23 Jun 2015 19:50:22 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 166ADAE2F7; Tue, 23 Jun 2015 19:50:22 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Message-ID: References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> <87k2uuc9mx.fsf@mail.linkov.net> Date: Tue, 23 Jun 2015 19:50:22 -0400 In-Reply-To: <87k2uuc9mx.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 24 Jun 2015 01:59:10 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5346=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5346> : inlines <3267> : streams <1460389> : uri <1967508> X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > in =E2=80=98shell-command-on-region=E2=80=99 to check for a rectangular r= egion and > insert the output accordingly, so I see no way to avoid checking for > =E2=80=98rectangle-mark-mode=E2=80=99 in =E2=80=98shell-command-on-region= =E2=80=99. In any case checking specifically for a rectangular region is wrong. Having a "fast-path" for the case of a simple contiguous region is fine, but the "slow&complex" path is not just for rectangular regions: the code should also work with a region made up of various arbitrary chunks (there's currently no package that provides this feature, but that's no excuse). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 18:33:00 2015 Received: (at 20626) by debbugs.gnu.org; 24 Jun 2015 22:33:00 +0000 Received: from localhost ([127.0.0.1]:56726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7tE3-0005Sl-IW for submit@debbugs.gnu.org; Wed, 24 Jun 2015 18:32:59 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:44305 helo=homiemail-a75.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7tE0-0005Sc-TB for 20626@debbugs.gnu.org; Wed, 24 Jun 2015 18:32:57 -0400 Received: from homiemail-a75.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTP id AFB995EC082; Wed, 24 Jun 2015 15:32:55 -0700 (PDT) Received: from localhost.linkov.net (m83-191-167-128.cust.tele2.ee [83.191.167.128]) (Authenticated sender: jurta@jurta.org) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTPA id 841BA5EC081; Wed, 24 Jun 2015 15:32:54 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Organization: LINKOV.NET References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> <87k2uuc9mx.fsf@mail.linkov.net> Date: Thu, 25 Jun 2015 01:27:18 +0300 In-Reply-To: (Stefan Monnier's message of "Tue, 23 Jun 2015 19:50:22 -0400") Message-ID: <87fv5g4u73.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) >> in =E2=80=98shell-command-on-region=E2=80=99 to check for a rectangula= r region and >> insert the output accordingly, so I see no way to avoid checking for >> =E2=80=98rectangle-mark-mode=E2=80=99 in =E2=80=98shell-command-on-reg= ion=E2=80=99. > > In any case checking specifically for a rectangular region is wrong. > Having a "fast-path" for the case of a simple contiguous region is fine= , > but the "slow&complex" path is not just for rectangular regions: > the code should also work with a region made up of various > arbitrary chunks (there's currently no package that provides this > feature, but that's no excuse). Then what about adding a new arg REGION to =E2=80=98shell-command-on-regi= on=E2=80=99 and other region-sensitive commands that will provide the region configuration including information about region type and region shape, e.g. a list in the form =E2=80=98(rectangle =E2=80=A6)=E2=80=99. Then th= e command's body will check the car of the arg REGION and act accordingly depending on the region shape. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 24 23:45:23 2015 Received: (at 20626) by debbugs.gnu.org; 25 Jun 2015 03:45:24 +0000 Received: from localhost ([127.0.0.1]:56841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7y6N-00040P-Fi for submit@debbugs.gnu.org; Wed, 24 Jun 2015 23:45:23 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:27504) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z7y6M-00040C-3g for 20626@debbugs.gnu.org; Wed, 24 Jun 2015 23:45:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A5FgA731xV/3+MCkxcgxCEAk6FB7tAh0sEAgKBPDsSAQEBAQEBAYEKQQWDXQEBAwEjMyMFCwkCGgIYDgICFBgNJIg3CI18nRCkFwEBAQcCAR+BIYoZhFIzB4JogUUBBLM/gUUjhBQigngBAQE X-IPAS-Result: A0A5FgA731xV/3+MCkxcgxCEAk6FB7tAh0sEAgKBPDsSAQEBAQEBAYEKQQWDXQEBAwEjMyMFCwkCGgIYDgICFBgNJIg3CI18nRCkFwEBAQcCAR+BIYoZhFIzB4JogUUBBLM/gUUjhBQigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="128246353" Received: from 76-10-140-127.dsl.teksavvy.com (HELO ceviche.home) ([76.10.140.127]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Jun 2015 23:45:16 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 1828B660F3; Wed, 24 Jun 2015 23:45:16 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Message-ID: References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> <87k2uuc9mx.fsf@mail.linkov.net> <87fv5g4u73.fsf@mail.linkov.net> Date: Wed, 24 Jun 2015 23:45:16 -0400 In-Reply-To: <87fv5g4u73.fsf@mail.linkov.net> (Juri Linkov's message of "Thu, 25 Jun 2015 01:27:18 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > e.g. a list in the form =E2=80=98(rectangle =E2=80=A6)=E2=80=99. Then th= e command's body > will check the car of the arg REGION and act accordingly depending > on the region shape. Same difference. It'd still have rectangle-specific code. Instead it should call something like region-extract-function to do what it needs to do and *this* thing will have rectangle-specific code (via something like an add-function in rect.el). IIUC the current region-extract-function doesn't satisfy all the needs of shell-command-on-region, so either it will have to be extended again, or we have to add more region--function or equivalent methods. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 25 19:17:41 2015 Received: (at 20626) by debbugs.gnu.org; 25 Jun 2015 23:17:42 +0000 Received: from localhost ([127.0.0.1]:57565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8GOq-0001wD-9G for submit@debbugs.gnu.org; Thu, 25 Jun 2015 19:17:41 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:44413 helo=homiemail-a11.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8GOn-0001vz-4B for 20626@debbugs.gnu.org; Thu, 25 Jun 2015 19:17:37 -0400 Received: from homiemail-a11.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTP id F03046E06C; Thu, 25 Jun 2015 16:17:35 -0700 (PDT) Received: from localhost.linkov.net (m83-191-223-24.cust.tele2.ee [83.191.223.24]) (Authenticated sender: jurta@jurta.org) by homiemail-a11.g.dreamhost.com (Postfix) with ESMTPA id D20E66E06A; Thu, 25 Jun 2015 16:17:34 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Organization: LINKOV.NET References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> <87k2uuc9mx.fsf@mail.linkov.net> Date: Fri, 26 Jun 2015 01:30:45 +0300 In-Reply-To: (Stefan Monnier's message of "Tue, 23 Jun 2015 19:50:22 -0400") Message-ID: <87twtv4byy.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) > In any case checking specifically for a rectangular region is wrong. > Having a "fast-path" for the case of a simple contiguous region is fine= , > but the "slow&complex" path is not just for rectangular regions: > the code should also work with a region made up of various > arbitrary chunks (there's currently no package that provides this > feature, but that's no excuse). It's more-less clear how to write code for the "slow&complex" path using the existing =E2=80=98region-extract-function=E2=80=99 and a new fu= nction like =E2=80=98region-insert-function=E2=80=99 like I demonstrated with define-= advice for shell-command-on-region in the beginning of this thread (where specific =E2=80=98insert-rectangle=E2=80=99 should be replaced with =E2=80= =98region-insert-function=E2=80=99). What is not clear is how to distinguish "slow&complex" from the "fast-pat= h"? Maybe with a new arg REGION? From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 25 21:53:53 2015 Received: (at 20626) by debbugs.gnu.org; 26 Jun 2015 01:53:53 +0000 Received: from localhost ([127.0.0.1]:57659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8Iq0-0007Iu-Py for submit@debbugs.gnu.org; Thu, 25 Jun 2015 21:53:53 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:59021) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8Ipy-0007Il-KM for 20626@debbugs.gnu.org; Thu, 25 Jun 2015 21:53:51 -0400 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t5Q1rgpu011921; Thu, 25 Jun 2015 21:53:42 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 5FDEEAE182; Thu, 25 Jun 2015 21:53:42 -0400 (EDT) From: Stefan Monnier To: Juri Linkov Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Message-ID: References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> <87k2uuc9mx.fsf@mail.linkov.net> <87twtv4byy.fsf@mail.linkov.net> Date: Thu, 25 Jun 2015 21:53:42 -0400 In-Reply-To: <87twtv4byy.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 26 Jun 2015 01:30:45 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV5348=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5348> : inlines <3288> : streams <1461521> : uri <1969379> X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.8 (--) > What is not clear is how to distinguish "slow&complex" from the "fast-path"? > Maybe with a new arg REGION? I thought it would be pretty easy: if region-extract-function returns a single contiguous chunk or multiple chunks. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 30 16:45:38 2015 Received: (at 20626) by debbugs.gnu.org; 30 Jun 2015 20:45:38 +0000 Received: from localhost ([127.0.0.1]:34816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZA2PQ-0002de-R7 for submit@debbugs.gnu.org; Tue, 30 Jun 2015 16:45:37 -0400 Received: from sub3.mail.dreamhost.com ([69.163.253.7]:37175 helo=homiemail-a18.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZA2PN-0002d9-He; Tue, 30 Jun 2015 16:45:33 -0400 Received: from homiemail-a18.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTP id 7A25A25006C; Tue, 30 Jun 2015 13:45:30 -0700 (PDT) Received: from localhost.linkov.net (m83-191-199-117.cust.tele2.ee [83.191.199.117]) (Authenticated sender: jurta@jurta.org) by homiemail-a18.g.dreamhost.com (Postfix) with ESMTPA id DB70D25006B; Tue, 30 Jun 2015 13:45:28 -0700 (PDT) From: Juri Linkov To: Stefan Monnier Subject: Re: bug#20626: Wishlist: M-x shell-command-on-rectangle-region Organization: LINKOV.NET References: <527474961.10107734.1432245870451.JavaMail.zimbra@comcast.net> <87twv51raf.fsf@mail.linkov.net> <87fv5s4pm0.fsf@mail.linkov.net> <874mlzweri.fsf@mail.linkov.net> <87k2uuc9mx.fsf@mail.linkov.net> <87twtv4byy.fsf@mail.linkov.net> Date: Tue, 30 Jun 2015 23:44:27 +0300 In-Reply-To: (Stefan Monnier's message of "Thu, 25 Jun 2015 21:53:42 -0400") Message-ID: <87a8vhsz83.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20626 Cc: 20626@debbugs.gnu.org, asparagus@comcast.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) forcemerge 19829 20626 thanks >> What is not clear is how to distinguish "slow&complex" from the "fast-= path"? >> Maybe with a new arg REGION? > > I thought it would be pretty easy: if region-extract-function returns > a single contiguous chunk or multiple chunks. =E2=80=98query-replace=E2=80=99 will use the same design, so merged it wi= th bug#19829 where I posted a composite patch. From unknown Mon Jun 23 06:01:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 12 Dec 2015 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator