nixpkgs/pkgs/applications/editors/emacs-modes/jdee/jde-directory-files-recurs.patch

26 lines
1.1 KiB
Diff
Raw Normal View History

This patch fixes a possible infinite recursion in `jde-directory-files-recurs'.
It could occur, e.g., when DIR contains multiple slashes: we end up recursing
on "DIR/." forever.
--- jde/lisp/jde.el (revision 90)
+++ jde/lisp/jde.el (working copy)
@@ -1500,14 +1500,14 @@ SYMBOL is unnecessary."
"Get all the files in DIR, and any subdirectories of DIR, whose
names match INCLUDE-REGEXP."
(let (files)
- (loop for file in (directory-files dir t) do
- (if (not (or (string= (concat dir "/.") file)
- (string= (concat dir "/..") file)))
+ (loop for file in (directory-files dir) do
+ (if (not (member file '("." "..")))
+ (let ((file (concat dir "/" file)))
(if (file-directory-p file)
(setq files (append files (jde-directory-files-recurs file include-regexp)))
(if (or (not include-regexp)
(string-match include-regexp file))
- (setq files (append files (list file)))))))
+ (setq files (append files (list file))))))))
files))
(defun jde-expand-directory (dir include-regexp exclude-regexps symbol)