Subject: bug#22678: closed (Re: bug#22678: 25.0.91; ibuffer-do-shell-command-file no output for non-visiting buffers)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 07 Jun 2016 23:29:02 +0000

Your bug report

#22678: 25.0.91; ibuffer-do-shell-command-file no output for non-visiting buffers

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
22678: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22678
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#22678: 25.0.91; ibuffer-do-shell-command-file no output for non-visiting buffers
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Tue, 07 Jun 2016 19:27:57 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 25.2

Thanks; applied.

Subject: 25.0.91; ibuffer-do-shell-command-file no output for non-visiting buffers
From: Tino Calancha <[email-masked]>
To: [email-masked]
Date: Mon, 15 Feb 2016 22:20:04 +0900 (JST)
List-Id: <debbugs-submit.debbugs.gnu.org>

This function creates all temporary files empty which doesn't
seem the intended behaviour.

emacs -Q --eval="(mapc (lambda(x) (switch-to-buffer x) (insert x)) '(\"foo\" \"bar\"))" --eval='(ibuffer)'w
% n ^\(foo\|bar\)$ RET
! cat RET
g
C-x b *Shell Command Output*
;; empty buffer

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

diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index f537561..86f57f9 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -347,10 +347,10 @@ shell-command-file
    :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))))))))))
+                          (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))))))
 
 ;;;###autoload (autoload 'ibuffer-do-eval "ibuf-ext")
 (define-ibuffer-op eval (form)