From 1da0fccc646d1921782dd6d701bc86004cfb3732 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 9 Dec 2023 18:42:36 -0500 Subject: [PATCH] * lisp/files.el (file-expand-wildcards): Fix sorting of subdirs E.g. (file-expand-wildcards "/u*/*m*") returned ("/usr/games" "/u/dummy" "/u/monnier" "/u/omnibook-disk") instead of ("/u/dummy" "/u/monnier" "/u/omnibook-disk" "/usr/games"). --- lisp/files.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 1cdcec23b11..047854d3939 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7539,12 +7539,12 @@ default directory. However, if FULL is non-nil, they are absolute." ;; if DIRPART contains wildcards. (dirs (if (and dirpart (string-match "[[*?]" (file-local-name dirpart))) - (mapcar 'file-name-as-directory + (mapcar #'file-name-as-directory (file-expand-wildcards (directory-file-name dirpart) nil regexp)) (list dirpart))) contents) - (dolist (dir dirs) + (dolist (dir (nreverse dirs)) (when (or (null dir) ; Possible if DIRPART is not wild. (file-accessible-directory-p dir)) (let ((this-dir-contents -- 2.39.2