changeset 97484:ed4b73533ff6

(eshell-ls-files): List one per line in a pipeline, unless at the end of the pipeline. (Bug#699).
author Glenn Morris <rgm@gnu.org>
date Fri, 15 Aug 2008 06:55:37 +0000
parents 3c44de892298
children 673065de92b7
files lisp/eshell/em-ls.el
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/eshell/em-ls.el	Fri Aug 15 06:55:11 2008 +0000
+++ b/lisp/eshell/em-ls.el	Fri Aug 15 06:55:37 2008 +0000
@@ -635,7 +635,14 @@
   "Output a list of FILES.
 Each member of FILES is either a string or a cons cell of the form
 \(FILE .  ATTRS)."
-  (if (memq listing-style '(long-listing single-column))
+  ;; Mimic behavior of coreutils ls, which lists a single file per
+  ;; line when output is not a tty.  Exceptions: if -x was supplied,
+  ;; or if we are the _last_ command in a pipeline.
+  ;; FIXME Not really the same since not testing output destination.
+  (if (or (and eshell-in-pipeline-p
+	       (not (eq eshell-in-pipeline-p 'last))
+	       (not (eq listing-style 'by-lines)))
+	  (memq listing-style '(long-listing single-column)))
       (eshell-for file files
 	(if file
 	    (eshell-ls-file file size-width copy-fileinfo)))