all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#22679: 25.0.91; ibuffer-do-shell-command-pipe truncate output
@ 2016-02-15 13:21 Tino Calancha
  2016-06-10  5:02 ` Glenn Morris
  0 siblings, 1 reply; 23+ messages in thread
From: Tino Calancha @ 2016-02-15 13:21 UTC (permalink / raw)
  To: 22679

[-- Attachment #1: Type: text/plain, Size: 456 bytes --]


Only the output of the last processed buffer is shown.
Maybe better if it is shown the concatenation of the output
of all of them.

emacs -Q --eval="(mapc (lambda(x) (switch-to-buffer x) (insert x)) '(\"foo\" \"bar\"))" --eval='(ibuffer)'
% n ^\(foo\|bar\)$ RET
| cat RET
g
C-x b * ibuffer-shell-output*
;;just show one word


In GNU Emacs 25.0.91.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.29)
Repository revision: 23ca48d3d867cfff9f49ef600e2aad7a26c7a870

[-- Attachment #2: Type: text/plain, Size: 2368 bytes --]

diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index f537561..8b1d4d2 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -323,9 +323,15 @@ shell-command-pipe
   (:interactive "sPipe to shell command: "
    :opstring "Shell command executed on"
    :modifier-p nil)
-  (shell-command-on-region
-   (point-min) (point-max) command
-   (get-buffer-create "* ibuffer-shell-output*")))
+  (let* ((out-buf (get-buffer-create "* ibuffer-shell-output*"))
+         (buffers (with-current-buffer "*Ibuffer*" (ibuffer-get-marked-buffers))))
+    (let ((string (with-temp-buffer
+                    (insert-buffer-substring buf)
+                    (shell-command-on-region (point-min) (point-max) command nil t)
+                    (buffer-substring-no-properties (point-min) (point-max)))))
+      (with-current-buffer out-buf
+        (when (eq buf (car buffers)) (erase-buffer))
+        (insert string)))))
 
 ;;;###autoload (autoload 'ibuffer-do-shell-command-pipe-replace "ibuf-ext")
 (define-ibuffer-op shell-command-pipe-replace (command)
@@ -345,12 +351,19 @@ shell-command-file
   (:interactive "sShell command on buffer's file: "
    :opstring "Shell command executed on"
    :modifier-p nil)
-  (shell-command (concat command " "
-			 (shell-quote-argument
-			  (if buffer-file-name
-			      buffer-file-name
-			    (make-temp-file
-			     (substring (buffer-name) 0 (min 10 (length (buffer-name))))))))))
+  (let* ((out-buf (get-buffer-create "*Shell Command Output*")) ; This function and shell-command-pipe
+                                                                ; should have same out buffer name.
+         (buffers (with-current-buffer "*Ibuffer*" (ibuffer-get-marked-buffers))))
+    (let* ((fname  (or buffer-file-name
+                       (let ((file (make-temp-file
+                                    (substring (buffer-name) 0 (min 10 (length (buffer-name)))))))
+                         (write-region (point-min) (point-max) file) file)))
+           (cmd    (format "%s %s" command (shell-quote-argument fname)))
+           (string (shell-command-to-string cmd)))
+
+      (with-current-buffer out-buf
+        (when (eq buf (car buffers)) (erase-buffer))
+        (insert string)))))
 
 ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext")
 (define-ibuffer-op eval (form)

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-02-09  9:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 13:21 bug#22679: 25.0.91; ibuffer-do-shell-command-pipe truncate output Tino Calancha
2016-06-10  5:02 ` Glenn Morris
     [not found]   ` <CAMn5WmYDL0CrDppLc_Vs+EM5CkA_wfdb1z+QCmNj_=v6PiYM-g@mail.gmail.com>
2016-06-10  9:08     ` Tino Calancha
2016-07-05 15:58       ` Glenn Morris
2016-07-05 16:27         ` Tino Calancha
2016-07-09 17:28           ` Glenn Morris
2016-07-13 15:27             ` Stefan Monnier
2016-08-19  8:33               ` Tino Calancha
2016-08-19 13:52                 ` Stefan Monnier
2016-08-20  3:28                   ` Tino Calancha
2016-08-20 10:28                   ` Tino Calancha
2016-08-20 12:46                     ` Stefan Monnier
2016-08-21 14:37                       ` Tino Calancha
2016-08-22 16:06                         ` Stefan Monnier
2016-08-23 15:08                           ` Tino Calancha
2016-08-24 17:05                             ` Stefan Monnier
2016-08-25  9:39                               ` Tino Calancha
2016-08-25 12:36                                 ` Stefan Monnier
2016-08-25 13:26                                   ` Tino Calancha
2017-01-27  6:26                               ` Tino Calancha
2017-02-03  4:25                                 ` Tino Calancha
2017-02-09  9:24                                   ` Tino Calancha
2016-06-11  3:48   ` C. Calancha

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.