summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>1999-01-29 11:31:33 +0000
committerAndreas Schwab <schwab@suse.de>1999-01-29 11:31:33 +0000
commit18b0f8cf6eddb9ae3414d00bf82e5b948b68c625 (patch)
tree591efb7368b3bc77e4f29a548db828a4b8d33d73 /lisp
parent13911e1d18d16831492ebe2c69d805c7fdd0aa8b (diff)
downloademacs-18b0f8cf6eddb9ae3414d00bf82e5b948b68c625.tar.gz
emacs-18b0f8cf6eddb9ae3414d00bf82e5b948b68c625.tar.bz2
emacs-18b0f8cf6eddb9ae3414d00bf82e5b948b68c625.zip
(file-expand-wildcards): Never consider `.' and `..' a
wildcard match. Fix regexp that tests if dirpart contains wildcard characters.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/files.el12
1 files changed, 9 insertions, 3 deletions
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))