[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master c0df64d: Dired w/ eshell-ls: Handle shell wildcards
From: |
Tino Calancha |
Subject: |
[Emacs-diffs] master c0df64d: Dired w/ eshell-ls: Handle shell wildcards in file name |
Date: |
Sun, 6 Aug 2017 00:28:00 -0400 (EDT) |
branch: master
commit c0df64db08b58cdac37cb38c16f2ba2f097fae92
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>
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.
---
lisp/eshell/em-ls.el | 27 +++++++++++++++++++--------
test/lisp/eshell/em-ls-tests.el | 18 ++++++++++++++++++
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 39f03ff..38e3813 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))
diff --git a/test/lisp/eshell/em-ls-tests.el b/test/lisp/eshell/em-ls-tests.el
index 71a555d..8e7b91d 100644
--- a/test/lisp/eshell/em-ls-tests.el
+++ b/test/lisp/eshell/em-ls-tests.el
@@ -75,6 +75,24 @@
(customize-set-variable 'eshell-ls-use-in-dired orig)
(and (buffer-live-p buf) (kill-buffer)))))
+(ert-deftest em-ls-test-bug27844 ()
+ "Test for http://debbugs.gnu.org/27844 ."
+ (let ((orig eshell-ls-use-in-dired)
+ (dired-use-ls-dired 'unspecified)
+ buf insert-directory-program)
+ (unwind-protect
+ (progn
+ (customize-set-variable 'eshell-ls-use-in-dired t)
+ (setq buf (dired (expand-file-name "lisp/*.el" source-directory)))
+ (dired-toggle-marks)
+ (should (cdr (dired-get-marked-files)))
+ (kill-buffer buf)
+ (setq buf (dired (expand-file-name "lisp/subr.el" source-directory)))
+ (should (looking-at "subr\\.el")))
+ (customize-set-variable 'eshell-ls-use-in-dired orig)
+ (and (buffer-live-p buf) (kill-buffer)))))
+
+
(provide 'em-ls-test)
;;; em-ls-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master c0df64d: Dired w/ eshell-ls: Handle shell wildcards in file name,
Tino Calancha <=