]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (file-expand-wildcards): Fix sorting of subdirs
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 9 Dec 2023 23:42:36 +0000 (18:42 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 9 Dec 2023 23:42:36 +0000 (18:42 -0500)
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

index 1cdcec23b1198a75e3ce5549a878e003d57c8397..047854d393942a84c464c330a0cb8521f56296c6 100644 (file)
@@ -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