From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#22679: 25.0.91; ibuffer-do-shell-command-pipe truncate output Date: Fri, 10 Jun 2016 18:08:28 +0900 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c077704cfcf340534e8e15f X-Trace: ger.gmane.org 1465549829 22083 80.91.229.3 (10 Jun 2016 09:10:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 Jun 2016 09:10:29 +0000 (UTC) To: 22679@debbugs.gnu.org, Tino Calancha Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 10 11:10:20 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1bBISI-0006oz-6x for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Jun 2016 11:10:18 +0200 Original-Received: from localhost ([::1]:39190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBISG-00079w-Uk for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Jun 2016 05:10:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBIRA-0006Jc-5B for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2016 05:09:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBIR4-0003Zu-55 for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2016 05:09:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51020) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBIR3-0003Zq-UF for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2016 05:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bBIR3-00062C-OS for bug-gnu-emacs@gnu.org; Fri, 10 Jun 2016 05:09:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Jun 2016 09:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22679 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 22679-submit@debbugs.gnu.org id=B22679.146554971723141 (code B ref 22679); Fri, 10 Jun 2016 09:09:01 +0000 Original-Received: (at 22679) by debbugs.gnu.org; 10 Jun 2016 09:08:37 +0000 Original-Received: from localhost ([127.0.0.1]:35124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBIQe-000619-TS for submit@debbugs.gnu.org; Fri, 10 Jun 2016 05:08:37 -0400 Original-Received: from mail-yw0-f170.google.com ([209.85.161.170]:33483) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bBIQc-00060n-PA for 22679@debbugs.gnu.org; Fri, 10 Jun 2016 05:08:35 -0400 Original-Received: by mail-yw0-f170.google.com with SMTP id g20so61185660ywb.0 for <22679@debbugs.gnu.org>; Fri, 10 Jun 2016 02:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Vz2YM3/P5kegpDMqOKhVJgs66TN2iHjqOkhyY/in7tQ=; b=ykRcq38HeK3Ew38kmS5In0KPVYPB4bQ9ojgwscbivkJRdZa/PKvWS/cgG7M+YRQNAG fAcZBp85rfjJBlGEPxfKy0s4gUecM4UYh0+iJmcqyirWD5KMgmNdf78T7zCdJBzXjDPv 7DUr3mJ3pP5gws3ubx83c7SGbKEO1SqyL+JDA7aRD+mNUi67aaZxj0RbPYimDLggfeaA lgMOW3Q4dngZycv1qqQKCwOmj+CLgmjK/tpHjAf2f05bIChA2xfOS1TIBEMIEluoLb2H B0TfrY1MB/IIuGoeno3jgZM8J20bbcKydMtBLWe0HQcXYYkgXi2NXJgGw8vVDlzw/wx6 Eoew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Vz2YM3/P5kegpDMqOKhVJgs66TN2iHjqOkhyY/in7tQ=; b=hLD8k2+CliDYerox+7MXNipJAOxGVyr5yTI7yFPgiBv+S7Mq4bMYxqfxZdykzCHQpQ BozTy7P3fqq3Bza1wV3RpMDuxF6G8rucnETwoC/ks2x8aATiXhRlCOmP8/6b1vbbO65s zMNezrHr7WpWnNjRvWfvyIQydSgWSeHNgHwdNNYlg9V1jnPTgo/JVNhAf8MouP0HOUun WWFhptqY+cbJhRKAqpoI0kTb9CvIqyrTj0/2ya8ydMP8L0Mb3iQqCIpVKXg1rq2T8xKQ LtjttmYlKAgtp2YFKasDx3c3CdO8YdzFNdjt9MotxhXbs8KtqzjYEsBnmVMZCrb56bCi ldfg== X-Gm-Message-State: ALyK8tLBrAyBG0X7pNd86CmHcfk0sxs6rOfok3KE5UX3p5VGrtvUGH7wnM7+2hXcKt3uXMxxZwvl9og6N7chmA== X-Received: by 10.13.224.5 with SMTP id j5mr400489ywe.195.1465549709101; Fri, 10 Jun 2016 02:08:29 -0700 (PDT) Original-Received: by 10.37.215.216 with HTTP; Fri, 10 Jun 2016 02:08:28 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119368 Archived-At: --94eb2c077704cfcf340534e8e15f Content-Type: text/plain; charset=UTF-8 >This seems like it would be a lot simpler if shell-command(-on-region) >did not unconditionally erase its output buffer. Although that behaviour >is long-standing, it seems unfriendly. It would be easier for callers >that wanted that to erase their own output buffers. It's less simple for >callers that want to preserve existing output to do so with the current >system. Adding an extra optional arg KEEP to shell-command family would do the job straightforward (see below patch). Maybe someone may complaint about one function having 9 (***) arguments (shell-command-on-region) inside a file called 'simple'. (***) I have noticed arg REGION-NONCONTIGUOUS-P is not mentioned in the doc string. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From b14efc632dfafbbc61863c060b9840a752704320 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Fri, 10 Jun 2016 17:44:48 +0900 Subject: [PATCH 1/2] Allow not erasing output buffer on shell-command * lisp/simple.el (async-shell-command) (shell-command, shell-command-on-region): Added optional arg KEEP (Bug#22679). --- lisp/simple.el | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 6c30929..59fa851 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3187,7 +3187,7 @@ async-shell-command-buffer :group 'shell :version "24.3") -(defun async-shell-command (command &optional output-buffer error-buffer) +(defun async-shell-command (command &optional output-buffer error-buffer keep) "Execute string COMMAND asynchronously in background. Like `shell-command', but adds `&' at the end of COMMAND @@ -3218,9 +3218,9 @@ async-shell-command shell-command-default-error-buffer)) (unless (string-match "&[ \t]*\\'" command) (setq command (concat command " &"))) - (shell-command command output-buffer error-buffer)) + (shell-command command output-buffer error-buffer keep)) -(defun shell-command (command &optional output-buffer error-buffer) +(defun shell-command (command &optional output-buffer error-buffer keep) "Execute string COMMAND in inferior shell; display output, if any. With prefix argument, insert the COMMAND's output at point. @@ -3274,6 +3274,9 @@ shell-command In an interactive call, the variable `shell-command-default-error-buffer' specifies the value of ERROR-BUFFER. +If the optional fourth argument KEEP is non-nil, the output buffer +is not erased before inserting the output. + In Elisp, you will often be better served by calling `call-process' or `start-process' directly, since it offers more control and does not impose the use of a shell (with its need to quote arguments)." @@ -3391,7 +3394,7 @@ shell-command ;; if some text has a non-nil read-only property, ;; which comint sometimes adds for prompts. (let ((inhibit-read-only t)) - (erase-buffer)) + (or keep (erase-buffer))) (display-buffer buffer '(nil (allow-no-window . t))) (setq default-directory directory) (setq proc (start-process "Shell" buffer shell-file-name @@ -3405,7 +3408,7 @@ shell-command )) ;; Otherwise, command is executed synchronously. (shell-command-on-region (point) (point) command - output-buffer nil error-buffer))))))) + output-buffer nil error-buffer nil nil keep))))))) (defun display-message-or-buffer (message &optional buffer-name action frame) "Display MESSAGE in the echo area if possible, otherwise in a pop-up buffer. @@ -3485,7 +3488,7 @@ shell-command-sentinel (defun shell-command-on-region (start end command &optional output-buffer replace error-buffer display-error-buffer - region-noncontiguous-p) + region-noncontiguous-p keep) "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 @@ -3533,7 +3536,10 @@ shell-command-on-region Optional seventh arg DISPLAY-ERROR-BUFFER, if non-nil, means to display the error buffer if there were any errors. When called -interactively, this is t." +interactively, this is t. + +Optional nineth arg KEEP, if non-nil, then the output buffer is +not erased before inserting the output." (interactive (let (string) (unless (mark) (user-error "The mark is not set now, so there is no region")) @@ -3618,7 +3624,9 @@ shell-command-on-region (setq buffer-read-only nil) (if (not output-buffer) (setq default-directory directory)) - (erase-buffer))) + (if keep + (goto-char (point-max)) + (erase-buffer)))) (setq exit-status (call-process-region start end shell-file-name nil (if error-file -- 2.8.1 >From 56f57e6321a7e37389329c6f8c54c340d12ee419 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Fri, 10 Jun 2016 17:56:30 +0900 Subject: [PATCH 2/2] Do not truncate output (Bug#22679) * lisp/ibuf-ext.el (shell-command-pipe, shell-command-file): --- lisp/ibuf-ext.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 0baab6b..9dd1eea 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -325,7 +325,8 @@ shell-command-pipe :modifier-p nil) (shell-command-on-region (point-min) (point-max) command - (get-buffer-create "* ibuffer-shell-output*"))) + (get-buffer-create "* ibuffer-shell-output*") + nil nil nil nil 'keep)) ;;;###autoload (autoload 'ibuffer-do-shell-command-pipe-replace "ibuf-ext") (define-ibuffer-op shell-command-pipe-replace (command) @@ -354,7 +355,7 @@ shell-command-file (buffer-name) 0 (min 10 (length (buffer-name))))))) (write-region nil nil file nil 0) - file)))))) + file)))) nil nil 'keep)) ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext") (define-ibuffer-op eval (form) -- 2.8.1 On Fri, Jun 10, 2016 at 6:04 PM, Tino Calancha wrote: > >This seems like it would be a lot simpler if shell-command(-on-region) > >did not unconditionally erase its output buffer. Although that behaviour > >is long-standing, it seems unfriendly. It would be easier for callers > >that wanted that to erase their own output buffers. It's less simple for > >callers that want to preserve existing output to do so with the current > >system. > > Adding an extra optional arg KEEP to shell-command family would do the job > straightforward (see below patch). Maybe someone may complaint about one > function having 9 (***) arguments (shell-command-on-region) inside a file > called > 'simple'. > > (***) I have noticed arg REGION-NONCONTIGUOUS-P is not mentioned in the > doc string. > > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > From b14efc632dfafbbc61863c060b9840a752704320 Mon Sep 17 00:00:00 2001 > From: Tino Calancha > Date: Fri, 10 Jun 2016 17:44:48 +0900 > Subject: [PATCH 1/2] Allow not erasing output buffer on shell-command > > * lisp/simple.el (async-shell-command) > (shell-command, shell-command-on-region): Added optional > arg KEEP (Bug#22679). > --- > lisp/simple.el | 24 ++++++++++++++++-------- > 1 file changed, 16 insertions(+), 8 deletions(-) > > diff --git a/lisp/simple.el b/lisp/simple.el > index 6c30929..59fa851 100644 > --- a/lisp/simple.el > +++ b/lisp/simple.el > @@ -3187,7 +3187,7 @@ async-shell-command-buffer > :group 'shell > :version "24.3") > > -(defun async-shell-command (command &optional output-buffer error-buffer) > +(defun async-shell-command (command &optional output-buffer error-buffer > keep) > "Execute string COMMAND asynchronously in background. > > Like `shell-command', but adds `&' at the end of COMMAND > @@ -3218,9 +3218,9 @@ async-shell-command > shell-command-default-error-buffer)) > (unless (string-match "&[ \t]*\\'" command) > (setq command (concat command " &"))) > - (shell-command command output-buffer error-buffer)) > + (shell-command command output-buffer error-buffer keep)) > > -(defun shell-command (command &optional output-buffer error-buffer) > +(defun shell-command (command &optional output-buffer error-buffer keep) > "Execute string COMMAND in inferior shell; display output, if any. > With prefix argument, insert the COMMAND's output at point. > > @@ -3274,6 +3274,9 @@ shell-command > In an interactive call, the variable `shell-command-default-error-buffer' > specifies the value of ERROR-BUFFER. > > +If the optional fourth argument KEEP is non-nil, the output buffer > +is not erased before inserting the output. > + > In Elisp, you will often be better served by calling `call-process' or > `start-process' directly, since it offers more control and does not impose > the use of a shell (with its need to quote arguments)." > @@ -3391,7 +3394,7 @@ shell-command > ;; if some text has a non-nil read-only property, > ;; which comint sometimes adds for prompts. > (let ((inhibit-read-only t)) > - (erase-buffer)) > + (or keep (erase-buffer))) > (display-buffer buffer '(nil (allow-no-window . t))) > (setq default-directory directory) > (setq proc (start-process "Shell" buffer shell-file-name > @@ -3405,7 +3408,7 @@ shell-command > )) > ;; Otherwise, command is executed synchronously. > (shell-command-on-region (point) (point) command > - output-buffer nil error-buffer))))))) > + output-buffer nil error-buffer nil nil keep))))))) > > (defun display-message-or-buffer (message &optional buffer-name action > frame) > "Display MESSAGE in the echo area if possible, otherwise in a pop-up > buffer. > @@ -3485,7 +3488,7 @@ shell-command-sentinel > (defun shell-command-on-region (start end command > &optional output-buffer replace > error-buffer display-error-buffer > - region-noncontiguous-p) > + region-noncontiguous-p keep) > "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 > @@ -3533,7 +3536,10 @@ shell-command-on-region > > Optional seventh arg DISPLAY-ERROR-BUFFER, if non-nil, means to > display the error buffer if there were any errors. When called > -interactively, this is t." > +interactively, this is t. > + > +Optional nineth arg KEEP, if non-nil, then the output buffer is > +not erased before inserting the output." > (interactive (let (string) > (unless (mark) > (user-error "The mark is not set now, so there is no region")) > @@ -3618,7 +3624,9 @@ shell-command-on-region > (setq buffer-read-only nil) > (if (not output-buffer) > (setq default-directory directory)) > - (erase-buffer))) > + (if keep > + (goto-char (point-max)) > + (erase-buffer)))) > (setq exit-status > (call-process-region start end shell-file-name nil > (if error-file > -- > 2.8.1 > > From 56f57e6321a7e37389329c6f8c54c340d12ee419 Mon Sep 17 00:00:00 2001 > From: Tino Calancha > Date: Fri, 10 Jun 2016 17:56:30 +0900 > Subject: [PATCH 2/2] Do not truncate output (Bug#22679) > > * lisp/ibuf-ext.el (shell-command-pipe, shell-command-file): > --- > lisp/ibuf-ext.el | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el > index 0baab6b..9dd1eea 100644 > --- a/lisp/ibuf-ext.el > +++ b/lisp/ibuf-ext.el > @@ -325,7 +325,8 @@ shell-command-pipe > :modifier-p nil) > (shell-command-on-region > (point-min) (point-max) command > - (get-buffer-create "* ibuffer-shell-output*"))) > + (get-buffer-create "* ibuffer-shell-output*") > + nil nil nil nil 'keep)) > > ;;;###autoload (autoload 'ibuffer-do-shell-command-pipe-replace > "ibuf-ext") > (define-ibuffer-op shell-command-pipe-replace (command) > @@ -354,7 +355,7 @@ shell-command-file > (buffer-name) 0 > (min 10 (length (buffer-name))))))) > (write-region nil nil file nil 0) > - file)))))) > + file)))) nil nil 'keep)) > > ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext") > (define-ibuffer-op eval (form) > -- > 2.8.1 > > > > On Fri, Jun 10, 2016 at 2:02 PM, Glenn Morris wrote: > >> >> This seems like it would be a lot simpler if shell-command(-on-region) >> did not unconditionally erase its output buffer. Although that behaviour >> is long-standing, it seems unfriendly. It would be easier for callers >> that wanted that to erase their own output buffers. It's less simple for >> callers that want to preserve existing output to do so with the current >> system. >> > > --94eb2c077704cfcf340534e8e15f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

>This seems like it would be a lot simpler if shell= -command(-on-region)
>did not unconditionally erase its output buffer= . Although that behaviour
>is long-standing, it seems unfriendly. It = would be easier for callers
>that wanted that to erase their own outp= ut buffers. It's less simple for
>callers that want to preserve e= xisting output to do so with the current
>system.

Adding an ex= tra optional arg KEEP to shell-command family would do the job
straightf= orward (see below patch).=C2=A0 Maybe someone may complaint about one
fu= nction having 9 (***) arguments (shell-command-on-region) inside a file cal= led
'simple'.

(***) I have noticed arg REGION-NONCONTIGUO= US-P is not mentioned in the doc string.

;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

From b14efc632d= fafbbc61863c060b9840a752704320 Mon Sep 17 00:00:00 2001
From: Tino Calan= cha <f92capac@gmail.com>Date: Fri, 10 Jun 2016 17:44:48 +0900
Subject: [PATCH 1/2] Allow not er= asing output buffer on shell-command

* lisp/simple.el (async-shell-c= ommand)
(shell-command, shell-command-on-region): Added optional
arg = KEEP (Bug#22679).
---
=C2=A0lisp/simple.el | 24 ++++++++++++++++-----= ---
=C2=A01 file changed, 16 insertions(+), 8 deletions(-)

diff -= -git a/lisp/simple.el b/lisp/simple.el
index 6c30929..59fa851 100644
= --- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3187,7 +3187,7 @@ async= -shell-command-buffer
=C2=A0=C2=A0 :group 'shell
=C2=A0=C2=A0 :ve= rsion "24.3")
=C2=A0
-(defun async-shell-command (command &= amp;optional output-buffer error-buffer)
+(defun async-shell-command (co= mmand &optional output-buffer error-buffer keep)
=C2=A0=C2=A0 "= Execute string COMMAND asynchronously in background.
=C2=A0
=C2=A0Lik= e `shell-command', but adds `&' at the end of COMMAND
@@ -32= 18,9 +3218,9 @@ async-shell-command
=C2=A0=C2=A0=C2=A0=C2=A0 shell-comma= nd-default-error-buffer))
=C2=A0=C2=A0 (unless (string-match "&= [ \t]*\\'" command)
=C2=A0=C2=A0=C2=A0=C2=A0 (setq command (con= cat command " &")))
-=C2=A0 (shell-command command output-= buffer error-buffer))
+=C2=A0 (shell-command command output-buffer error= -buffer keep))
=C2=A0
-(defun shell-command (command &optional ou= tput-buffer error-buffer)
+(defun shell-command (command &optional o= utput-buffer error-buffer keep)
=C2=A0=C2=A0 "Execute string COMMAN= D in inferior shell; display output, if any.
=C2=A0With prefix argument,= insert the COMMAND's output at point.
=C2=A0
@@ -3274,6 +3274,9 = @@ shell-command
=C2=A0In an interactive call, the variable `shell-comma= nd-default-error-buffer'
=C2=A0specifies the value of ERROR-BUFFER.<= br>=C2=A0
+If the optional fourth argument KEEP is non-nil, the output b= uffer
+is not erased before inserting the output.
+
=C2=A0In Elisp= , you will often be better served by calling `call-process' or
=C2= =A0`start-process' directly, since it offers more control and does not = impose
=C2=A0the use of a shell (with its need to quote arguments)."= ;
@@ -3391,7 +3394,7 @@ shell-command
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 =C2=A0 ;; if some text has a non-nil read-only property,
= =C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 ;; which comint sometime= s adds for prompts.
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 (= let ((inhibit-read-only t))
-=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 (erase-buffer))
+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 (or keep (erase-buffer)))
=C2=A0=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0 (display-buffer buffer '(nil (allow-no-window= . t)))
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 (setq default= -directory directory)
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= (setq proc (start-process "Shell" buffer shell-file-name
@@ -= 3405,7 +3408,7 @@ shell-command
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0 ))
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ;; Otherwise, = command is executed synchronously.
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 (shell-command-on-region (point) (point) command
-=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0=C2=A0 output-buffer nil error-buffer)))))))
+=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0 output-buffer nil error-buffer nil nil keep)))))))
=C2=A0
=C2= =A0(defun display-message-or-buffer (message &optional buffer-name acti= on frame)
=C2=A0=C2=A0 "Display MESSAGE in the echo area if possibl= e, otherwise in a pop-up buffer.
@@ -3485,7 +3488,7 @@ shell-command-sen= tinel
=C2=A0(defun shell-command-on-region (start end command
=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &optional output-buffer replace
=C2= =A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 error-buffer display-error-buffer
-= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 region-noncontiguous-p)
+=C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 region-noncontiguous-p keep)
=C2=A0=C2=A0 "Execu= te string COMMAND in inferior shell with region as input.
=C2=A0Normally= display output (if any) in temp buffer `*Shell Command Output*';
= =C2=A0Prefix arg means replace the region with it.=C2=A0 Return the exit co= de of
@@ -3533,7 +3536,10 @@ shell-command-on-region
=C2=A0
=C2=A0= Optional seventh arg DISPLAY-ERROR-BUFFER, if non-nil, means to
=C2=A0di= splay the error buffer if there were any errors.=C2=A0 When called
-inte= ractively, this is t."
+interactively, this is t.
+
+Optional= nineth arg KEEP, if non-nil, then the output buffer is
+not erased befo= re inserting the output."
=C2=A0=C2=A0 (interactive (let (string)=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(unless (mark)
=C2= =A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 (user-error "The= mark is not set now, so there is no region"))
@@ -3618,7 +3624,9 @= @ shell-command-on-region
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (setq buffer-read-only nil)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (if (not output-buffer)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq default-directory directory))
-=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (erase-buffer)))
+=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (if keep
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (goto-char (point-max))
+=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (erase-buffer))))
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (setq exit-status
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (call-process-region start end shell-file-name nil
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (if error-file
--
2.8.1

From 56f57e6321= a7e37389329c6f8c54c340d12ee419 Mon Sep 17 00:00:00 2001
From: Tino Calan= cha <f92capac@gmail.com>Date: Fri, 10 Jun 2016 17:56:30 +0900
Subject: [PATCH 2/2] Do not trunc= ate output (Bug#22679)

* lisp/ibuf-ext.el (shell-command-pipe, shell= -command-file):
---
=C2=A0lisp/ibuf-ext.el | 5 +++--
=C2=A01 file = changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ibuf-ext.= el b/lisp/ibuf-ext.el
index 0baab6b..9dd1eea 100644
--- a/lisp/ibuf-e= xt.el
+++ b/lisp/ibuf-ext.el
@@ -325,7 +325,8 @@ shell-command-pipe=C2=A0=C2=A0=C2=A0 :modifier-p nil)
=C2=A0=C2=A0 (shell-command-on-reg= ion
=C2=A0=C2=A0=C2=A0 (point-min) (point-max) command
-=C2=A0=C2=A0 = (get-buffer-create "* ibuffer-shell-output*")))
+=C2=A0=C2=A0 = (get-buffer-create "* ibuffer-shell-output*")
+=C2=A0=C2=A0 ni= l nil nil nil 'keep))
=C2=A0
=C2=A0;;;###autoload (autoload '= ibuffer-do-shell-command-pipe-replace "ibuf-ext")
=C2=A0(defin= e-ibuffer-op shell-command-pipe-replace (command)
@@ -354,7 +355,7 @@ sh= ell-command-file
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (buffer-n= ame) 0
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (min 10 (length (bu= ffer-name)))))))
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 (write-region nil nil file nil 0)
-=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 file)= )))))
+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0 file)))) nil nil 'keep))
=C2=A0
=C2=A0;;;###autoload= (autoload 'ibuffer-do-eval "ibuf-ext")
=C2=A0(define-ibuf= fer-op eval (form)
--
2.8.1



On Fri, Jun 10, 2016 at 6:04 PM, Tino Ca= lancha <f92capac@gmail.com> wrote:
>This seems like i= t would be a lot simpler if shell-command(-on-region)
>did not uncond= itionally erase its output buffer. Although that behaviour
>is long-s= tanding, it seems unfriendly. It would be easier for callers
>that wa= nted that to erase their own output buffers. It's less simple for
&g= t;callers that want to preserve existing output to do so with the current>system.

Adding an extra optional arg KEEP to shell= -command family would do the job
straightforward (see below patch).=C2= =A0 Maybe someone may complaint about one
function having 9 (***) argume= nts (shell-command-on-region) inside a file called
'simple'.
=
(***) I have noticed arg REGION-NONCONTIGUOUS-P is not mentioned in the= doc string.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;= ;;;;;;;;;;;;;;;;;;;;;;;;

From b14efc632dfafbbc61863c060b9840a7527043= 20 Mon Sep 17 00:00:00 2001
From: Tino Calancha <f92capac@gmail.com>
Date: Fri= , 10 Jun 2016 17:44:48 +0900
Subject: [PATCH 1/2] Allow not erasing outp= ut buffer on shell-command

* lisp/simple.el (async-shell-command)(shell-command, shell-command-on-region): Added optional
arg KEEP (Bug#= 22679).
---
=C2=A0lisp/simple.el | 24 ++++++++++++++++--------
=C2= =A01 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/lis= p/simple.el b/lisp/simple.el
index 6c30929..59fa851 100644
--- a/lisp= /simple.el
+++ b/lisp/simple.el
@@ -3187,7 +3187,7 @@ async-shell-com= mand-buffer
=C2=A0=C2=A0 :group 'shell
=C2=A0=C2=A0 :version &quo= t;24.3")
=C2=A0
-(defun async-shell-command (command &option= al output-buffer error-buffer)
+(defun async-shell-command (command &= ;optional output-buffer error-buffer keep)
=C2=A0=C2=A0 "Execute st= ring COMMAND asynchronously in background.
=C2=A0
=C2=A0Like `shell-c= ommand', but adds `&' at the end of COMMAND
@@ -3218,9 +3218= ,9 @@ async-shell-command
=C2=A0=C2=A0=C2=A0=C2=A0 shell-command-default= -error-buffer))
=C2=A0=C2=A0 (unless (string-match "&[ \t]*\\&#= 39;" command)
=C2=A0=C2=A0=C2=A0=C2=A0 (setq command (concat comman= d " &")))
-=C2=A0 (shell-command command output-buffer err= or-buffer))
+=C2=A0 (shell-command command output-buffer error-buffer ke= ep))
=C2=A0
-(defun shell-command (command &optional output-buffe= r error-buffer)
+(defun shell-command (command &optional output-buff= er error-buffer keep)
=C2=A0=C2=A0 "Execute string COMMAND in infer= ior shell; display output, if any.
=C2=A0With prefix argument, insert th= e COMMAND's output at point.
=C2=A0
@@ -3274,6 +3274,9 @@ shell-c= ommand
=C2=A0In an interactive call, the variable `shell-command-default= -error-buffer'
=C2=A0specifies the value of ERROR-BUFFER.
=C2=A0<= br>+If the optional fourth argument KEEP is non-nil, the output buffer
+= is not erased before inserting the output.
+
=C2=A0In Elisp, you will= often be better served by calling `call-process' or
=C2=A0`start-pr= ocess' directly, since it offers more control and does not impose
= =C2=A0the use of a shell (with its need to quote arguments)."
@@ -3= 391,7 +3394,7 @@ shell-command
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0 ;; if some text has a non-nil read-only property,
=C2=A0=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 ;; which comint sometimes adds fo= r prompts.
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 (let ((inh= ibit-read-only t))
-=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 (erase-buffer))
+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 (or keep (erase-buffer)))
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0 (display-buffer buffer '(nil (allow-no-window . t)))=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 (setq default-director= y directory)
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 (setq pr= oc (start-process "Shell" buffer shell-file-name
@@ -3405,7 +3= 408,7 @@ shell-command
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0 ))
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 ;; Otherwise, command= is executed synchronously.
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = (shell-command-on-region (point) (point) command
-=C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0 output-buffer nil error-buffer)))))))
+=C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0 ou= tput-buffer nil error-buffer nil nil keep)))))))
=C2=A0
=C2=A0(defun = display-message-or-buffer (message &optional buffer-name action frame)<= br>=C2=A0=C2=A0 "Display MESSAGE in the echo area if possible, otherwi= se in a pop-up buffer.
@@ -3485,7 +3488,7 @@ shell-command-sentinel
= =C2=A0(defun shell-command-on-region (start end command
=C2=A0=C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 &optional output-buffer replace
=C2=A0=C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 error-buffer display-error-buffer
-=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 region-noncontiguous-p)
+=C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 region-noncontiguous-p keep)
=C2=A0=C2=A0 "Execute str= ing COMMAND in inferior shell with region as input.
=C2=A0Normally displ= ay output (if any) in temp buffer `*Shell Command Output*';
=C2=A0Pr= efix arg means replace the region with it.=C2=A0 Return the exit code of@@ -3533,7 +3536,10 @@ shell-command-on-region
=C2=A0
=C2=A0Optional= seventh arg DISPLAY-ERROR-BUFFER, if non-nil, means to
=C2=A0display th= e error buffer if there were any errors.=C2=A0 When called
-interactivel= y, this is t."
+interactively, this is t.
+
+Optional nineth = arg KEEP, if non-nil, then the output buffer is
+not erased before inser= ting the output."
=C2=A0=C2=A0 (interactive (let (string)
=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0(unless (mark)
=C2=A0=C2=A0= =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 (user-error "The mark is = not set now, so there is no region"))
@@ -3618,7 +3624,9 @@ shell-c= ommand-on-region
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq bu= ffer-read-only nil)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (if (= not output-buffer)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (setq default-directory directory))
-=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (erase-buffer)))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (if keep
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 (goto-char (point-max))
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (erase-buffer))))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (setq ex= it-status
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (c= all-process-region start end shell-file-name nil
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (if error-file
--
2.8.1

From 56f57e6321a7e373893= 29c6f8c54c340d12ee419 Mon Sep 17 00:00:00 2001
From: Tino Calancha <<= a href=3D"mailto:f92capac@gmail.com" target=3D"_blank">f92capac@gmail.com>
Date: Fri, 10 Jun 2016 17:56:30 +0900
Subject: [PATCH 2/2] Do = not truncate output (Bug#22679)

* lisp/ibuf-ext.el (shell-command-pi= pe, shell-command-file):
---
=C2=A0lisp/ibuf-ext.el | 5 +++--
=C2= =A01 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp= /ibuf-ext.el b/lisp/ibuf-ext.el
index 0baab6b..9dd1eea 100644
--- a/l= isp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -325,7 +325,8 @@ shell-comm= and-pipe
=C2=A0=C2=A0=C2=A0 :modifier-p nil)
=C2=A0=C2=A0 (shell-comm= and-on-region
=C2=A0=C2=A0=C2=A0 (point-min) (point-max) command
-=C2= =A0=C2=A0 (get-buffer-create "* ibuffer-shell-output*")))
+=C2= =A0=C2=A0 (get-buffer-create "* ibuffer-shell-output*")
+=C2= =A0=C2=A0 nil nil nil nil 'keep))
=C2=A0
=C2=A0;;;###autoload (au= toload 'ibuffer-do-shell-command-pipe-replace "ibuf-ext")
= =C2=A0(define-ibuffer-op shell-command-pipe-replace (command)
@@ -354,7 = +355,7 @@ shell-command-file
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (buffer-name) 0
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (min 10 (= length (buffer-name)))))))
=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 = =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 (write-region nil nil file nil 0)
= -=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 file))))))
+=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 file)))) nil nil 'keep))
=C2=A0
=C2=A0;;;###a= utoload (autoload 'ibuffer-do-eval "ibuf-ext")
=C2=A0(defi= ne-ibuffer-op eval (form)--
2.8.1



On Fri,= Jun 10, 2016 at 2:02 PM, Glenn Morris <rgm@gnu.org> wrote:

This seems like it would be a lot simpler if shell-command(-on-region)
did not unconditionally erase its output buffer. Although that behaviour is long-standing, it seems unfriendly. It would be easier for callers
that wanted that to erase their own output buffers. It's less simple fo= r
callers that want to preserve existing output to do so with the current
system.


--94eb2c077704cfcf340534e8e15f--