From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#27844: 26.0.50; Dired w/ eshell-ls doesn't support wildcards in file name Date: Thu, 27 Jul 2017 12:27:05 +0900 Message-ID: <878tjasgom.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1501126095 29731 195.159.176.226 (27 Jul 2017 03:28:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Jul 2017 03:28:15 +0000 (UTC) To: 27844@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 27 05:28:07 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daZT0-00078r-P4 for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Jul 2017 05:28:02 +0200 Original-Received: from localhost ([::1]:41008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daZT6-0003pQ-Jk for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Jul 2017 23:28:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48888) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daZT1-0003pL-E9 for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2017 23:28:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daZT0-0006rx-Dp for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2017 23:28:03 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55150) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1daZT0-0006rq-AE for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2017 23:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1daZT0-0002yd-0V for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2017 23:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Jul 2017 03:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150112604111388 (code B ref -1); Thu, 27 Jul 2017 03:28:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jul 2017 03:27:21 +0000 Original-Received: from localhost ([127.0.0.1]:57827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daZSK-0002xc-NO for submit@debbugs.gnu.org; Wed, 26 Jul 2017 23:27:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57533) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daZSI-0002xL-VY for submit@debbugs.gnu.org; Wed, 26 Jul 2017 23:27:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daZSB-0006RW-UU for submit@debbugs.gnu.org; Wed, 26 Jul 2017 23:27:13 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57322) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1daZSB-0006RL-RJ for submit@debbugs.gnu.org; Wed, 26 Jul 2017 23:27:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daZSA-0003nT-Cf for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2017 23:27:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daZS9-0006QY-63 for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2017 23:27:10 -0400 Original-Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]:33195) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1daZS9-0006QD-04 for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2017 23:27:09 -0400 Original-Received: by mail-pf0-x235.google.com with SMTP id d67so10329149pfc.0 for ; Wed, 26 Jul 2017 20:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=RIPmb75OlHG2F5e33ltdfymE25R/yYijbqOknsJlZAo=; b=Q1JdkkkRXhxylupIOCCsok5kdGFN9Onp7h16xLBnZdIQhBqI4HiHr2UMq5f7aFJ7q7 v8iiKy6HO5J3h1HJWWBGtVlhYR5i3X5vUgJKT4DhxE6PuW93T29K3WTfMbeEzrNS7oD5 di6pH0lDB8HWKGPsiiDEVpiQOj1eA0i9DMpTxSVlpTGKgPJcjH4bqmZ3lal3+4k2QTRr 7+7GfFm1WgfKJPGvB1ziUAJE+dNhex6PUx45O/A+k1d6hsLm0++/HVGmkI+2Vimgfu7R 6To0cmLKU8EKovdzoYOcyCEFfhtDTqQ+/DJ1C9hH0VSNzA4ExJvquyJz19Wsji/vKmnf EjXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=RIPmb75OlHG2F5e33ltdfymE25R/yYijbqOknsJlZAo=; b=dSIZ4jtjMjOVSKdL6qMwOBTpMLxmV1xsVvMeZwLoV8DodgvpQDEFGh9p7y0vSVils5 YQbIF/gJDfAdpWCtLDApvr3fSlS4LOOI6bsTZ7eq1aoMhRVnYKFVI7edt5U+KUSxb+4C HvGvpVAXidTzHLdJLr8Q5VOJbMjiWxYvX9jpDRQsgeXl+2rYot0W4kOQXuwiuDpATzIH JL5luMFxCsJ5S3R62R4An3z4GQS/Hwm34z+9CqhD4UeJA6ykwg3kXLB9cVCpAHRAx21X KSyGXXQbhosfvfKjntzTZh9Mnul/FMG9R6AK2nUCDbLTzZzr1Ga9h60jEwKA6sVPJ3tO hPnQ== X-Gm-Message-State: AIVw11180/gSG0MAMd3RKsA6IS1fTVWIY90b5vPXfpmWk3on4ou8Jv8t K6Yaso0liaQuNQDi X-Received: by 10.98.23.69 with SMTP id 66mr2789904pfx.305.1501126027685; Wed, 26 Jul 2017 20:27:07 -0700 (PDT) Original-Received: from calancha-pc ([240f:6e:fb29:1:9ee6:2511:da80:1c7e]) by smtp.gmail.com with ESMTPSA id k185sm32711547pgc.31.2017.07.26.20.27.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jul 2017 20:27:07 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:135039 Archived-At: 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 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