summaryrefslogtreecommitdiff
path: root/lisp/eshell
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2017-08-06 13:23:05 +0900
committerTino Calancha <tino.calancha@gmail.com>2017-08-06 13:23:18 +0900
commitc0df64db08b58cdac37cb38c16f2ba2f097fae92 (patch)
tree2b6bdf70a4ff60bc367aa56d26e94d097262b546 /lisp/eshell
parent7c3593f81724d0c7a2ee2f90797db0e705adc859 (diff)
downloademacs-c0df64db08b58cdac37cb38c16f2ba2f097fae92.tar.gz
Dired w/ eshell-ls: Handle shell wildcards in file name
* lisp/eshell/em-ls.el (eshell-ls--insert-directory): Use eshell-extended-glob (Bug#27844). * test/lisp/dired-tests.el (dired-test-bug27844): Add test.
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/em-ls.el27
1 files changed, 19 insertions, 8 deletions
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 39f03ffb79e..38e38132bf7 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -243,6 +243,9 @@ scope during the evaluation of TEST-SEXP."
;;; Functions:
+(declare-function eshell-extended-glob "em-glob" (glob))
+(defvar eshell-error-if-no-glob)
+
(defun eshell-ls--insert-directory
(orig-fun file switches &optional wildcard full-directory-p)
"Insert directory listing for FILE, formatted according to SWITCHES.
@@ -275,14 +278,22 @@ instead."
(set 'font-lock-buffers
(delq (current-buffer)
(symbol-value 'font-lock-buffers)))))
- (let ((insert-func 'insert)
- (error-func 'insert)
- (flush-func 'ignore)
- (switches
- (append eshell-ls-dired-initial-args
- (and (or (consp dired-directory) wildcard) (list "-d"))
- switches)))
- (eshell-do-ls (nconc switches (list file)))))))))
+ (require 'em-glob)
+ (let* ((insert-func 'insert)
+ (error-func 'insert)
+ (flush-func 'ignore)
+ (eshell-error-if-no-glob t)
+ (target ; Expand the shell wildcards if any.
+ (if (and (atom file)
+ (string-match "[[?*]" file)
+ (not (file-exists-p file)))
+ (mapcar #'file-relative-name (eshell-extended-glob file))
+ (file-relative-name file)))
+ (switches
+ (append eshell-ls-dired-initial-args
+ (and (or (consp dired-directory) wildcard) (list "-d"))
+ switches)))
+ (eshell-do-ls (nconc switches (list target)))))))))
(declare-function eshell-extended-glob "em-glob" (glob))