branch: externals/compat commit 355d5806b1b81f45606aa153669051fa3a0fadc4 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Drop broken directory-files-recursively The function has not been introduced properly in Compat. It was introduced in 25.1 and got additional arguments in 27.1 --- NEWS.org | 1 + compat-25.el | 61 --------------------------------------------------------- compat-tests.el | 6 ------ compat.texi | 28 -------------------------- 4 files changed, 1 insertion(+), 95 deletions(-) diff --git a/NEWS.org b/NEWS.org index b35fd4e24f..ac27e480a6 100644 --- a/NEWS.org +++ b/NEWS.org @@ -24,6 +24,7 @@ - Deprecate ~compat-help.el~ and ~compat-font-lock.el.~ - Development moved to GitHub. - BREAKING: Drop broken function ~func-arity~. +- BREAKING: Drop broken function ~directory-files-recursively~. - BREAKING: Drop support for Emacs 24.3. Emacs 24.4 is required now. * Release of "Compat" Version 28.1.2.2 diff --git a/compat-25.el b/compat-25.el index b58dcf6145..3febccb3f6 100644 --- a/compat-25.el +++ b/compat-25.el @@ -245,66 +245,5 @@ threading." (compat-defalias function-put put) ;; <OK> -;;;; Defined in files.el - -(compat-defun directory-files-recursively ;; <UNTESTED> - (dir regexp &optional include-directories predicate follow-symlinks) - "Return list of all files under directory DIR whose names match REGEXP. -This function works recursively. Files are returned in \"depth -first\" order, and files from each directory are sorted in -alphabetical order. Each file name appears in the returned list -in its absolute form. - -By default, the returned list excludes directories, but if -optional argument INCLUDE-DIRECTORIES is non-nil, they are -included. - -PREDICATE can be either nil (which means that all subdirectories -of DIR are descended into), t (which means that subdirectories that -can't be read are ignored), or a function (which is called with -the name of each subdirectory, and should return non-nil if the -subdirectory is to be descended into). - -If FOLLOW-SYMLINKS is non-nil, symbolic links that point to -directories are followed. Note that this can lead to infinite -recursion." - (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 (concat dir "/" leaf))) - ;; Don't follow symlinks to other directories. - (when (and (or (not (file-symlink-p full-file)) - (and (file-symlink-p full-file) - follow-symlinks)) - ;; Allow filtering subdirectories. - (or (eq predicate nil) - (eq predicate t) - (funcall predicate full-file))) - (let ((sub-files - (if (eq predicate t) - (condition-case nil - (directory-files-recursively - full-file regexp include-directories - predicate follow-symlinks) - (file-error nil)) - (directory-files-recursively - full-file regexp include-directories - predicate follow-symlinks)))) - (setq result (nconc result sub-files)))) - (when (and include-directories - (string-match regexp leaf)) - (setq result (nconc result (list full-file))))) - (when (string-match regexp file) - (push (concat dir "/" file) files))))) - (nconc result (nreverse files)))) - (provide 'compat-25) ;;; compat-25.el ends here diff --git a/compat-tests.el b/compat-tests.el index db2fea3637..ce03aa684b 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1637,11 +1637,5 @@ )) (should-not (string-match-p regexp-unmatchable str)))) -;; TODO fix broken test -;;(ert-deftest directory-files-recursively -;; (should-equal -;; (compat-sort (directory-files-recursively "." "make\\|copying") #'string<) -;; '("./.github/workflows/makefile.yml" "./COPYING" "./Makefile")))) - (provide 'compat-tests) ;;; compat-tests.el ends here diff --git a/compat.texi b/compat.texi index 65815dd8bf..3a03902194 100644 --- a/compat.texi +++ b/compat.texi @@ -391,34 +391,6 @@ performs one step of the expansion: if the result is another macro call, @xref{Expansion,Expansion,,elisp}. @end defun -@c copied from lispref/files.texi -@defun directory-files-recursively directory regexp &optional include-directories predicate follow-symlinks -Return all files under @var{directory} whose names match @var{regexp}. -This function searches the specified @var{directory} and its -sub-directories, recursively, for files whose basenames (i.e., without -the leading directories) match the specified @var{regexp}, and returns a -list of the absolute file names of the matching files (@pxref{Relative -File Names, absolute file names,,elisp}). The file names are returned -in depth-first order, meaning that files in some sub-directory are -returned before the files in its parent directory. In addition, -matching files found in each subdirectory are sorted alphabetically by -their basenames. By default, directories whose names match @var{regexp} -are omitted from the list, but if the optional argument -@var{include-directories} is non-@code{nil}, they are included. - -By default, all subdirectories are descended into. If @var{predicate} -is @code{t}, errors when trying to descend into a subdirectory (for -instance, if it's not readable by this user) are ignored. If it's -neither @code{nil} nor @code{t}, it should be a function that takes one -parameter (the subdirectory name) and should return non-@code{nil} if -the directory is to be descended into. - -Symbolic links to subdirectories are not followed by default, but if -@var{follow-symlinks} is non-@code{nil}, they are followed. - -@xref{Contents of Directories,,,elisp}. -@end defun - @defun bool-vector &rest objects This function creates and returns a bool-vector whose elements are the arguments, @var{objects}.