]> git.eshelyaron.com Git - emacs.git/commitdiff
(file-expand-wildcards): Never consider `.' and `..' a
authorAndreas Schwab <schwab@suse.de>
Fri, 29 Jan 1999 11:31:33 +0000 (11:31 +0000)
committerAndreas Schwab <schwab@suse.de>
Fri, 29 Jan 1999 11:31:33 +0000 (11:31 +0000)
wildcard match.  Fix regexp that tests if dirpart contains
wildcard characters.

lisp/files.el

index fac089fc977cc79c267ca53d45315da73836402b..ace250533d89be78f0f0fc92ec7bad09c3cc7197 100644 (file)
@@ -3112,7 +3112,7 @@ default directory.  However, if FULL is non-nil, they are absolute."
         ;; A list of all dirs that DIRPART specifies.
         ;; This can be more than one dir
         ;; if DIRPART contains wildcards.
-        (dirs (if (and dirpart (string-match "[[.*+\\^$?]" dirpart))
+        (dirs (if (and dirpart (string-match "[[*?]" dirpart))
                   (mapcar 'file-name-as-directory
                           (file-expand-wildcards (directory-file-name dirpart)))
                 (list dirpart)))
@@ -3121,8 +3121,14 @@ default directory.  However, if FULL is non-nil, they are absolute."
       (when (or (null (car dirs))      ; Possible if DIRPART is not wild.
                (file-directory-p (directory-file-name (car dirs))))
        (let ((this-dir-contents
-              (directory-files (or (car dirs) ".") full
-                               (wildcard-to-regexp nondir))))
+              ;; Filter out "." and ".."
+              (delq nil
+                    (mapcar #'(lambda (name)
+                                (unless (string-match "\\`\\.\\.?\\'"
+                                                      (file-name-nondirectory name))
+                                  name))
+                            (directory-files (or (car dirs) ".") full
+                                             (wildcard-to-regexp nondir))))))
          (setq contents
                (nconc
                 (if (and (car dirs) (not full))