|
2 | 2 | ;;; Commentary: |
3 | 3 | ;;; Code: |
4 | 4 |
|
5 | | -(eask-defvc< 27 |
6 | | - (defun directory-files-recursively (dir regexp |
| 5 | +;; XXX: Support after Emacs 27.1 |
| 6 | +(defun eask-directory-files-recursively ( dir regexp |
7 | 7 | &optional include-directories predicate |
8 | 8 | follow-symlinks) |
9 | | - "..." |
10 | | - (let* ((result nil) |
11 | | - (files nil) |
12 | | - (dir (directory-file-name dir)) |
13 | | - ;; When DIR is "/", remote file names like "/method:" could |
14 | | - ;; also be offered. We shall suppress them. |
15 | | - (tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir))))) |
16 | | - (dolist (file (sort (file-name-all-completions "" dir) |
17 | | - 'string<)) |
18 | | - (unless (member file '("./" "../")) |
19 | | - (if (directory-name-p file) |
20 | | - (let* ((leaf (substring file 0 (1- (length file)))) |
21 | | - (full-file (concat dir "/" leaf))) |
22 | | - ;; Don't follow symlinks to other directories. |
23 | | - (when (and (or (not (file-symlink-p full-file)) |
24 | | - (and (file-symlink-p full-file) |
25 | | - follow-symlinks)) |
26 | | - ;; Allow filtering subdirectories. |
27 | | - (or (eq predicate nil) |
28 | | - (eq predicate t) |
29 | | - (funcall predicate full-file))) |
30 | | - (let ((sub-files |
31 | | - (if (eq predicate t) |
32 | | - (ignore-error file-error |
33 | | - (directory-files-recursively |
34 | | - full-file regexp include-directories |
35 | | - predicate follow-symlinks)) |
36 | | - (directory-files-recursively |
37 | | - full-file regexp include-directories |
38 | | - predicate follow-symlinks)))) |
39 | | - (setq result (nconc result sub-files)))) |
40 | | - (when (and include-directories |
41 | | - (string-match regexp leaf)) |
42 | | - (setq result (nconc result (list full-file))))) |
43 | | - (when (string-match regexp file) |
44 | | - (push (concat dir "/" file) files))))) |
45 | | - (nconc result (nreverse files))))) |
| 9 | + "..." |
| 10 | + (let* ((result nil) |
| 11 | + (files nil) |
| 12 | + (dir (directory-file-name dir)) |
| 13 | + ;; When DIR is "/", remote file names like "/method:" could |
| 14 | + ;; also be offered. We shall suppress them. |
| 15 | + (tramp-mode (and tramp-mode (file-remote-p (expand-file-name dir))))) |
| 16 | + (dolist (file (sort (file-name-all-completions "" dir) |
| 17 | + 'string<)) |
| 18 | + (unless (member file '("./" "../")) |
| 19 | + (if (directory-name-p file) |
| 20 | + (let* ((leaf (substring file 0 (1- (length file)))) |
| 21 | + (full-file (concat dir "/" leaf))) |
| 22 | + ;; Don't follow symlinks to other directories. |
| 23 | + (when (and (or (not (file-symlink-p full-file)) |
| 24 | + (and (file-symlink-p full-file) |
| 25 | + follow-symlinks)) |
| 26 | + ;; Allow filtering subdirectories. |
| 27 | + (or (eq predicate nil) |
| 28 | + (eq predicate t) |
| 29 | + (funcall predicate full-file))) |
| 30 | + (let ((sub-files |
| 31 | + (if (eq predicate t) |
| 32 | + (ignore-error file-error |
| 33 | + (eask-directory-files-recursively |
| 34 | + full-file regexp include-directories |
| 35 | + predicate follow-symlinks)) |
| 36 | + (eask-directory-files-recursively |
| 37 | + full-file regexp include-directories |
| 38 | + predicate follow-symlinks)))) |
| 39 | + (setq result (nconc result sub-files)))) |
| 40 | + (when (and include-directories |
| 41 | + (string-match regexp leaf)) |
| 42 | + (setq result (nconc result (list full-file))))) |
| 43 | + (when (string-match regexp file) |
| 44 | + (push (concat dir "/" file) files))))) |
| 45 | + (nconc result (nreverse files)))) |
46 | 46 |
|
47 | | -(eask-defvc< 28 |
48 | | - (defun always (&rest _arguments) |
49 | | - "Ignore ARGUMENTS, do nothing, and return t. |
50 | | -This function accepts any number of arguments in ARGUMENTS. |
51 | | -Also see `ignore'." |
52 | | - t)) |
| 47 | +;; XXX: Support after Emacs 28.1 |
| 48 | +(defun eask-always (&rest _arguments) |
| 49 | + "..." |
| 50 | + t) |
53 | 51 |
|
54 | 52 | ;;; extern/compat.el ends here |
0 commit comments