From: Andreas Schwab Date: Fri, 29 Jan 1999 11:31:33 +0000 (+0000) Subject: (file-expand-wildcards): Never consider `.' and `..' a X-Git-Tag: emacs-20.4~732 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=18b0f8cf6eddb9ae3414d00bf82e5b948b68c625;p=emacs.git (file-expand-wildcards): Never consider `.' and `..' a wildcard match. Fix regexp that tests if dirpart contains wildcard characters. --- diff --git a/lisp/files.el b/lisp/files.el index fac089fc977..ace250533d8 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -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))