;; 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)))
(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))