Function: eshell-ls--dired

eshell-ls--dired is an interactive and byte-compiled function defined in em-ls.el.gz.

Signature

(eshell-ls--dired ORIG-FUN DIR-OR-LIST &optional SWITCHES)

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-ls.el.gz
(defun eshell-ls--dired (orig-fun dir-or-list &optional switches)
  (interactive (dired-read-dir-and-switches ""))
  (require 'em-glob)
  (if (consp dir-or-list)
      (funcall orig-fun dir-or-list switches)
    (let ((dir-wildcard (insert-directory-wildcard-in-dir-p
                         (expand-file-name dir-or-list))))
      (if (not dir-wildcard)
          (funcall orig-fun dir-or-list switches)
        (let* ((default-directory (car dir-wildcard))
               (files (eshell-extended-glob (cdr dir-wildcard)))
               (dir (car dir-wildcard)))
          (if files
              (let ((inhibit-read-only t)
                    (buf
                     (apply orig-fun
                            (nconc (list dir) files)
                            (and switches (list switches)))))
                (with-current-buffer buf
                  (save-excursion
                    (goto-char (point-min))
                    (dired-goto-next-file)
                    (forward-line 0)
                    (insert "  wildcard " (cdr dir-wildcard) "\n"))))
            (user-error "No files matching regexp")))))))