[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master e820f16: Added file-tree-walk to files.el.
From: |
Michael Heerdegen |
Subject: |
Re: master e820f16: Added file-tree-walk to files.el. |
Date: |
Fri, 05 Dec 2014 19:37:23 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
"Eric S. Raymond" <address@hidden> writes:
> Added file-tree-walk to files.el.
FWIW, I recently wrote quite the same as addition to my iterator
package. Whereby I use a recursion predicate of it's own, and the
action is to be applied after defining the iterator:
--8<---------------cut here---------------start------------->8---
(defun gen-of-files-df (dir &optional exclude-dirs)
(cl-callf or exclude-dirs #'ignore)
(let ((files (if (funcall exclude-dirs dir)
'()
(directory-files dir t)))
subgen file)
(gen-delq
nil
(gen-make
(if (not subgen)
(if (not files)
'gen-done
(setq file (pop files))
(if (string-match-p
"\\`\\.+\\'" (file-name-nondirectory file))
nil
(when (and (file-directory-p file)
(not (file-symlink-p file)))
(setq subgen (gen-of-files-df file exclude-dirs)))
file))
(setq file (gen-next subgen))
(if (not (eq file 'gen-done))
file
(setq subgen nil)
nil))))))
--8<---------------cut here---------------end--------------->8---
And I guess it would be cool to have a breadth-first file-tree walker as
well?
Regards,
Michael.
- Re: master e820f16: Added file-tree-walk to files.el.,
Michael Heerdegen <=