summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-07-10 14:03:55 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-07-10 14:03:55 +0200
commitba59181c41a4685b595200306c6585a004c41e26 (patch)
tree8ce6d06820eec55b997e0550a84bdb4d72a115b6 /lisp/files.el
parent9524e1f6a6afeb5925376cdfd294740da591e7c3 (diff)
downloademacs-ba59181c41a4685b595200306c6585a004c41e26.tar.gz
Fix problem with files like "~" in `directory-files-recursively'
* lisp/files.el (directory-files-recursively): Don't bug out on files like "~" that have special meaning to `expand-file-name' (bug#36490).
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/files.el b/lisp/files.el
index e8a44af8ea5..b2249bfcb48 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -819,17 +819,18 @@ order, and files from each directory are sorted in alphabetical order.
Each file name appears in the returned list in its absolute form.
Optional argument INCLUDE-DIRECTORIES non-nil means also include in the
output directories whose names match REGEXP."
- (let ((result nil)
- (files nil)
- ;; When DIR is "/", remote file names like "/method:" could
- ;; also be offered. We shall suppress them.
- (tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir)))))
+ (let* ((result nil)
+ (files nil)
+ (dir (directory-file-name dir))
+ ;; When DIR is "/", remote file names like "/method:" could
+ ;; also be offered. We shall suppress them.
+ (tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir)))))
(dolist (file (sort (file-name-all-completions "" dir)
'string<))
(unless (member file '("./" "../"))
(if (directory-name-p file)
(let* ((leaf (substring file 0 (1- (length file))))
- (full-file (expand-file-name leaf dir)))
+ (full-file (concat dir "/" leaf)))
;; Don't follow symlinks to other directories.
(unless (file-symlink-p full-file)
(setq result
@@ -839,7 +840,7 @@ output directories whose names match REGEXP."
(string-match regexp leaf))
(setq result (nconc result (list full-file)))))
(when (string-match regexp file)
- (push (expand-file-name file dir) files)))))
+ (push (concat dir "/" file) files)))))
(nconc result (nreverse files))))
(defvar module-file-suffix)