GNU bug report logs - #27844
26.0.50; Dired w/ eshell-ls doesn't support wildcards in file name

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Thu, 27 Jul 2017 03:28:01 UTC

Severity: minor

Found in version 26.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Tino Calancha <tino.calancha <at> gmail.com>
Subject: bug#27844: closed (Re: bug#27844: 26.0.50; Dired w/ eshell-ls
 doesn't support wildcards in file name)
Date: Sun, 06 Aug 2017 04:31:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#27844: 26.0.50; Dired w/ eshell-ls doesn't support wildcards in file name

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 27844 <at> debbugs.gnu.org.

-- 
27844: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=27844
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Tino Calancha <tino.calancha <at> gmail.com>
To: 27844-done <at> debbugs.gnu.org
Subject: Re: bug#27844: 26.0.50;
 Dired w/ eshell-ls doesn't support wildcards in file name
Date: Sun, 06 Aug 2017 13:30:06 +0900
Eli Zaretskii <eliz <at> gnu.org> writes:

>>     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.
>
> LGTM, thanks.
Pushed fix into master branch as commit
c0df64db08b58cdac37cb38c16f2ba2f097fae92
(Dired w/ eshell-ls: Handle shell wildcards in file name)

[Message part 3 (message/rfc822, inline)]
From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; Dired w/ eshell-ls doesn't support wildcards in file name
Date: Thu, 27 Jul 2017 12:27:05 +0900
Dired with eshell-ls doesn't handle wildcards in file names.
emacs -Q -l em-ls -eval "(customize-set-variable 'eshell-ls-use-in-dired t)"

I)
M-: (dired source-directory) RET
C-x d lisp/*.el RET

II)
;; Following works but it shows full file name, instead of the
;; more common relative file name.
C-x d lisp/simple.el RET

--8<-----------------------------cut here---------------start------------->8---
commit 8826109f3b619b59b7d68afa55e446e0c487ca76
Author: Tino Calancha <tino.calancha <at> gmail.com>
Date:   Thu Jul 27 12:21:15 2017 +0900

    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.

diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 79799db30b..48f3874bf7 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -241,6 +241,8 @@ dired-flag
 
 ;;; Functions:
 
+(declare-function eshell-extended-glob "em-glob" (glob))
+
 (defun eshell-ls--insert-directory
   (orig-fun file switches &optional wildcard full-directory-p)
   "Insert directory listing for FILE, formatted according to SWITCHES.
@@ -273,11 +275,18 @@ eshell-ls--insert-directory
                 (set 'font-lock-buffers
                      (delq (current-buffer)
                            (symbol-value 'font-lock-buffers)))))
+          (require 'em-glob)
           (let ((insert-func 'insert)
                 (error-func 'insert)
                 (flush-func 'ignore)
+                (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)))
                 eshell-ls-dired-initial-args)
-            (eshell-do-ls (append switches (list file)))))))))
+            (eshell-do-ls (append switches (list target)))))))))
 
 (defsubst eshell/ls (&rest args)
   "An alias version of `eshell-do-ls'."
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 601d65768b..16086b97a9 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -188,5 +188,24 @@
       (customize-set-variable 'eshell-ls-use-in-dired orig)
       (and (buffer-live-p buf) (kill-buffer)))))
 
+
+(ert-deftest dired-test-bug27844 ()
+  "Test for http://debbugs.gnu.org/27844 ."
+  (require 'em-ls)
+  (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 'dired-tests)
 ;; dired-tests.el ends here

--8<-----------------------------cut here---------------end--------------->8---

In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-07-26
Repository revision: e1e8d2e229f48b3cee765f7cf27ae04ee4401d85



This bug report was last modified 7 years and 296 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.