[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 b365a7cc32: Fix expansion of wildcards in ls-lisp.el
From: |
Eli Zaretskii |
Subject: |
emacs-29 b365a7cc32: Fix expansion of wildcards in ls-lisp.el |
Date: |
Sun, 15 Jan 2023 03:49:21 -0500 (EST) |
branch: emacs-29
commit b365a7cc32e223e428d082a74d0780df223ad193
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix expansion of wildcards in ls-lisp.el
* lisp/ls-lisp.el (ls-lisp--dired): Fix error message text.
Handle the case of a wildcard specifying directories. (Bug#60819)
---
lisp/ls-lisp.el | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 217bebcfcb..81ff14932c 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -482,8 +482,22 @@ not contain `d', so that a full listing is expected."
(if (not dir-wildcard)
(funcall orig-fun dir-or-list switches)
(let* ((default-directory (car dir-wildcard))
- (files (file-expand-wildcards (cdr dir-wildcard)))
+ (wildcard (cdr dir-wildcard))
+ (files (file-expand-wildcards wildcard))
(dir (car dir-wildcard)))
+ ;; When the wildcard ends in a slash, file-expand-wildcards
+ ;; returns nil; fix that by treating the wildcards as
+ ;; specifying only directories whose names match the
+ ;; widlcard.
+ (if (and (null files)
+ (directory-name-p wildcard))
+ (setq files
+ (delq nil
+ (mapcar (lambda (fname)
+ (if (file-accessible-directory-p fname)
+ fname))
+ (file-expand-wildcards
+ (directory-file-name wildcard))))))
(if files
(let ((inhibit-read-only t)
(buf
@@ -494,7 +508,7 @@ not contain `d', so that a full listing is expected."
(dired-goto-next-file)
(forward-line 0)
(insert " wildcard " (cdr dir-wildcard) "\n"))))
- (user-error "No files matching regexp")))))))
+ (user-error "No files matching wildcard")))))))
(advice-add 'dired :around #'ls-lisp--dired)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 b365a7cc32: Fix expansion of wildcards in ls-lisp.el,
Eli Zaretskii <=