changeset 24217:37a08636670b

(file-expand-wildcards): Never consider `.' and `..' a wildcard match. Fix regexp that tests if dirpart contains wildcard characters.
author Andreas Schwab <schwab@suse.de>
date Fri, 29 Jan 1999 11:31:33 +0000
parents 45e1b3418311
children f3a482ad0fd6
files lisp/files.el
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Thu Jan 28 19:45:13 1999 +0000
+++ b/lisp/files.el	Fri Jan 29 11:31:33 1999 +0000
@@ -3112,7 +3112,7 @@
 	 ;; 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 @@
       (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))