From: Tino Calancha <tino.calancha@gmail.com>
To: 27844@debbugs.gnu.org
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 [thread overview]
Message-ID: <87h8xyutc3.fsf@calancha-pc> (raw)
In-Reply-To: <878tjasgom.fsf@calancha-pc> (Tino Calancha's message of "Thu, 27 Jul 2017 12:27:05 +0900")
Tino Calancha <tino.calancha@gmail.com> 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 <tino.calancha@gmail.com>
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
next prev parent reply other threads:[~2017-07-27 9:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 3:27 bug#27844: 26.0.50; Dired w/ eshell-ls doesn't support wildcards in file name Tino Calancha
2017-07-27 9:23 ` Tino Calancha [this message]
2017-07-29 9:06 ` Eli Zaretskii
2017-08-01 3:00 ` Tino Calancha
2017-08-01 13:40 ` Eli Zaretskii
2017-08-01 14:06 ` Tino Calancha
2017-08-01 15:37 ` Eli Zaretskii
2017-08-01 16:04 ` Tino Calancha
2017-08-01 18:43 ` Eli Zaretskii
2017-08-02 8:49 ` Tino Calancha
2017-08-04 13:15 ` Eli Zaretskii
2017-07-29 9:05 ` Eli Zaretskii
2017-08-06 4:30 ` Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h8xyutc3.fsf@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=27844@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.