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 18:23:08 +0900 Message-ID: <87h8xyutc3.fsf@calancha-pc> References: <878tjasgom.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1501147480 23684 195.159.176.226 (27 Jul 2017 09:24:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Jul 2017 09:24:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: 27844@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 27 11:24:33 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 1daf1b-0005Bx-Jj for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Jul 2017 11:24:07 +0200 Original-Received: from localhost ([::1]:41960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daf1h-0003ju-DO for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Jul 2017 05:24:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1daf1b-0003jb-EV for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2017 05:24:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1daf1W-0005Yr-EM for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2017 05:24:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55224) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1daf1W-0005Yn-Ag for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2017 05:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1daf1W-0002vK-50 for bug-gnu-emacs@gnu.org; Thu, 27 Jul 2017 05:24: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 09:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27844 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27844-submit@debbugs.gnu.org id=B27844.150114740411182 (code B ref 27844); Thu, 27 Jul 2017 09:24:02 +0000 Original-Received: (at 27844) by debbugs.gnu.org; 27 Jul 2017 09:23:24 +0000 Original-Received: from localhost ([127.0.0.1]:57901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daf0t-0002uH-V1 for submit@debbugs.gnu.org; Thu, 27 Jul 2017 05:23:24 -0400 Original-Received: from mail-pf0-f176.google.com ([209.85.192.176]:34766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1daf0s-0002u2-KI for 27844@debbugs.gnu.org; Thu, 27 Jul 2017 05:23:23 -0400 Original-Received: by mail-pf0-f176.google.com with SMTP id q85so81491418pfq.1 for <27844@debbugs.gnu.org>; Thu, 27 Jul 2017 02:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=wxpNF5JtOkAdxS84TT3I1iaKQ0OwX4b1lzlgE+RduUM=; b=P6dqDrq5h3eDYMViwXbJnJrK15sCji6GhzvYdNXFBYGXdxdyeHAyNKqHfaPNkChqFR ox6VReoZbjaKe2fIeuCXlXihb7Ksil4GPb4GfZFXAtY6V47NEU97eMDrYsJuxGDke0Pe 6boHPU2OnlYBtdubyRyCpWKWWoG7i95s9qP0cMQgCtOknduOhRw3H11aL/kQEtf2gwK0 /Nn36TiStwehT56gGYKAmkSbWxvp+v9ootLUeHBjuoUtlwyTKToKPbEdNW1TxrCaQYMh +C8Q9seLBfbt5VpCwKr9Y/TAlAdId9RcspKt70SzlwiWvN697B1zCcIuEKBGzD5x7OnN 5wyA== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=wxpNF5JtOkAdxS84TT3I1iaKQ0OwX4b1lzlgE+RduUM=; b=gTkmeWhsPHeYxeM+yx9Bv2nXwJtn7XQwCsiyZkILkv8BjDSpB2bQZEeaS6vA1EKqn+ xCUaWoeyjgDizqLA9DOTwcW8z/tPhGZIGy1s0ymgjki4BUNwtbQ7jtuYSDjH6dXOiDFt Ci8RqQPUyf/nN0FaxbJUax29BtmVz8EIWmMST4qKCYUFlwGIVtdeZigwIhYSvX3ngqzB 0CZQsg7PpvmEd1TCBi1TmAyWvQeWVRLbqxa3nbSnNZm6m0SbUfDEu0pfNhVKu0cIBlMP PAQ3QNSeAu8l8g4sqYti1kY2SHeCuwRdmRDLUosrqQCuYetewWaBO6vBRMNJdGli530G fTmQ== X-Gm-Message-State: AIVw112V+QG1I8ns709890me0kT/UxRsQQZALL6J/lTOq2nDdL3BOBxO mcFeEw7ePO/eiKhb X-Received: by 10.84.128.4 with SMTP id 4mr92939pla.184.1501147396017; Thu, 27 Jul 2017 02:23:16 -0700 (PDT) Original-Received: from calancha-pc ([240f:6e:fb29:1:9ee6:2511:da80:1c7e]) by smtp.gmail.com with ESMTPSA id y22sm34897695pfi.159.2017.07.27.02.23.13 for <27844@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Jul 2017 02:23:15 -0700 (PDT) In-Reply-To: <878tjasgom.fsf@calancha-pc> (Tino Calancha's message of "Thu, 27 Jul 2017 12:27:05 +0900") 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:135043 Archived-At: Tino Calancha writes: > Dired with eshell-ls doesn't handle wildcards in file names. > > ;;; 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-extended-glob' returns a list of matches on success, otherwise it returns FILE; if no match i think we should signal an error. --8<-----------------------------cut here---------------start------------->8--- commit 22f4516a6081c57363790694a11e5f9fe3f84c70 Author: Tino Calancha Date: Thu Jul 27 18:08:17 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..2e0b16db75 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,21 @@ 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))) + (let ((matches (eshell-extended-glob file))) + (if (consp matches) + (mapcar #'file-relative-name matches) + (user-error (format "%s: No files matching wildcard" 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'." --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-27 Repository revision: 28faa94f1c423091bb34c2776eabe9ae83e5b4fc