aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/eshell
diff options
context:
space:
mode:
authorTino Calancha2017-08-06 13:23:05 +0900
committerTino Calancha2017-08-06 13:23:18 +0900
commitc0df64db08b58cdac37cb38c16f2ba2f097fae92 (patch)
tree2b6bdf70a4ff60bc367aa56d26e94d097262b546 /lisp/eshell
parent7c3593f81724d0c7a2ee2f90797db0e705adc859 (diff)
downloademacs-c0df64db08b58cdac37cb38c16f2ba2f097fae92.tar.gz
emacs-c0df64db08b58cdac37cb38c16f2ba2f097fae92.zip
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."
243 243
244;;; Functions: 244;;; Functions:
245 245
246(declare-function eshell-extended-glob "em-glob" (glob))
247(defvar eshell-error-if-no-glob)
248
246(defun eshell-ls--insert-directory 249(defun eshell-ls--insert-directory
247 (orig-fun file switches &optional wildcard full-directory-p) 250 (orig-fun file switches &optional wildcard full-directory-p)
248 "Insert directory listing for FILE, formatted according to SWITCHES. 251 "Insert directory listing for FILE, formatted according to SWITCHES.
@@ -275,14 +278,22 @@ instead."
275 (set 'font-lock-buffers 278 (set 'font-lock-buffers
276 (delq (current-buffer) 279 (delq (current-buffer)
277 (symbol-value 'font-lock-buffers))))) 280 (symbol-value 'font-lock-buffers)))))
278 (let ((insert-func 'insert) 281 (require 'em-glob)
279 (error-func 'insert) 282 (let* ((insert-func 'insert)
280 (flush-func 'ignore) 283 (error-func 'insert)
281 (switches 284 (flush-func 'ignore)
282 (append eshell-ls-dired-initial-args 285 (eshell-error-if-no-glob t)
283 (and (or (consp dired-directory) wildcard) (list "-d")) 286 (target ; Expand the shell wildcards if any.
284 switches))) 287 (if (and (atom file)
285 (eshell-do-ls (nconc switches (list file))))))))) 288 (string-match "[[?*]" file)
289 (not (file-exists-p file)))
290 (mapcar #'file-relative-name (eshell-extended-glob file))
291 (file-relative-name file)))
292 (switches
293 (append eshell-ls-dired-initial-args
294 (and (or (consp dired-directory) wildcard) (list "-d"))
295 switches)))
296 (eshell-do-ls (nconc switches (list target)))))))))
286 297
287 298
288(declare-function eshell-extended-glob "em-glob" (glob)) 299(declare-function eshell-extended-glob "em-glob" (glob))