aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2015-01-07 20:52:24 -0800
committerGlenn Morris2015-01-07 20:52:24 -0800
commitffa860390226f192f97518670c6cee4d2449cd9d (patch)
treed0616090bd0eda17ed4d29a0b57275fb4be8c417
parentdff81fa7b7a0f44ade333eeb4f7c0d91c5ad5214 (diff)
downloademacs-ffa860390226f192f97518670c6cee4d2449cd9d.tar.gz
emacs-ffa860390226f192f97518670c6cee4d2449cd9d.zip
* lisp/files.el (file-tree-walk): Remove; of unknown authorship.
* etc/NEWS: Remove entry. Fixes: debbugs:19325
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/files.el32
3 files changed, 4 insertions, 36 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 4d704ce5c67..f22309e2fac 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -141,10 +141,6 @@ this has no effect.
141** A new text property `inhibit-read-only' can be used in read-only 141** A new text property `inhibit-read-only' can be used in read-only
142buffers to allow certain parts of the text to be writable. 142buffers to allow certain parts of the text to be writable.
143 143
144** A new function `file-tree-walk' allows to apply a certain action
145to all the files and subdirectories of a directory, similarly to the C
146library function `ftw'.
147
148** A new function `directory-files-recursively' returns all matching 144** A new function `directory-files-recursively' returns all matching
149files (recursively) under a directory. 145files (recursively) under a directory.
150 146
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5297877189e..88fd36759a9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12015-01-08 Glenn Morris <rgm@gnu.org>
2
3 * files.el (file-tree-walk): Remove; of unknown authorship. (Bug#19325)
4
12015-01-07 K. Handa <handa@gnu.org> 52015-01-07 K. Handa <handa@gnu.org>
2 6
3 * international/ccl.el (define-ccl-program): Improve the docstring. 7 * international/ccl.el (define-ccl-program): Improve the docstring.
diff --git a/lisp/files.el b/lisp/files.el
index 80b538c3267..1533c35e6ca 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -729,38 +729,6 @@ The path separator is colon in GNU and GNU-like systems."
729 (lambda (f) (and (file-directory-p f) 'dir-ok))) 729 (lambda (f) (and (file-directory-p f) 'dir-ok)))
730 (error "No such directory found via CDPATH environment variable")))) 730 (error "No such directory found via CDPATH environment variable"))))
731 731
732(defun file-tree-walk (dir action &rest args)
733 "Walk DIR executing ACTION on each file, with ARGS as additional arguments.
734For each file, the function calls ACTION as follows:
735
736 \(ACTION DIRECTORY BASENAME ARGS\)
737
738Where DIRECTORY is the leading directory of the file,
739 BASENAME is the basename of the file,
740 and ARGS are as specified in the call to this function, or nil if omitted.
741
742The ACTION is applied to each subdirectory before descending into
743it, and if nil is returned at that point, the descent will be
744prevented. Directory entries are sorted with string-lessp."
745 (cond ((file-directory-p dir)
746 (setq dir (file-name-as-directory dir))
747 (let ((lst (directory-files dir nil nil t))
748 fullname file)
749 (while lst
750 (setq file (car lst))
751 (setq lst (cdr lst))
752 (cond ((member file '("." "..")))
753 (t
754 (and (apply action dir file args)
755 (setq fullname (concat dir file))
756 (file-directory-p fullname)
757 (apply 'file-tree-walk fullname action args)))))))
758 (t
759 (apply action
760 (file-name-directory dir)
761 (file-name-nondirectory dir)
762 args))))
763
764(defsubst directory-name-p (name) 732(defsubst directory-name-p (name)
765 "Return non-nil if NAME ends with a slash character." 733 "Return non-nil if NAME ends with a slash character."
766 (and (> (length name) 0) 734 (and (> (length name) 0)