Function: eshell-ls-entries

eshell-ls-entries is a byte-compiled function defined in em-ls.el.gz.

Signature

(eshell-ls-entries ENTRIES &optional SEPARATE ROOT-DIR)

Documentation

Output PATH's directory ENTRIES.

Each member of ENTRIES may either be a string or a cons cell, the car of which is the file name, and the cdr of which is the list of attributes. If SEPARATE is non-nil, directories name will be entirely separated from the filenames. This is the normal behavior, except when doing a recursive listing. ROOT-DIR, if non-nil, specifies the root directory of the listing, to which non-absolute directory names will be made relative if ever they need to be printed.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-ls.el.gz
(defun eshell-ls-entries (entries &optional separate root-dir)
  "Output PATH's directory ENTRIES.
Each member of ENTRIES may either be a string or a cons cell, the car
of which is the file name, and the cdr of which is the list of
attributes.
If SEPARATE is non-nil, directories name will be entirely separated
from the filenames.  This is the normal behavior, except when doing a
recursive listing.
ROOT-DIR, if non-nil, specifies the root directory of the listing, to
which non-absolute directory names will be made relative if ever they
need to be printed."
  (let (dirs files show-names need-return (size-width 0))
    (dolist (entry entries)
      (if (and (not dir-literal)
	       (or (eshell-ls-filetype-p (cdr entry) ?d)
		   (and (eshell-ls-filetype-p (cdr entry) ?l)
			(file-directory-p (car entry)))))
	  (progn
	    (unless separate
	      (setq files (cons entry files)
		    size-width
		    (if show-size
			(max size-width
			     (length (eshell-ls-printable-size
				      (file-attribute-size (cdr entry)) t))))))
	    (setq dirs (cons entry dirs)))
	(setq files (cons entry files)
	      size-width
	      (if show-size
		  (max size-width
		       (length (eshell-ls-printable-size
				(file-attribute-size (cdr entry)) t)))))))
    (when files
      (eshell-ls-files (eshell-ls-sort-entries files)
		       size-width show-recursive)
      (setq need-return t))
    (setq show-names (or show-recursive
			 (> (+ (length files) (length dirs)) 1)))
    (dolist (dir (eshell-ls-sort-entries dirs))
      (if (and need-return (not dir-literal))
	  (funcall insert-func "\n"))
      (eshell-ls-dir dir show-names
		     (unless (file-name-absolute-p (car dir)) root-dir)
		     size-width)
      (setq need-return t))))