[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/path-iterator df995c1 02/10: In path-iterator, fix head
From: |
Stefan Monnier |
Subject: |
[elpa] externals/path-iterator df995c1 02/10: In path-iterator, fix header comment syntax, add Commentary |
Date: |
Tue, 1 Dec 2020 16:43:56 -0500 (EST) |
branch: externals/path-iterator
commit df995c143e0fbe0975ce923999acc686f8814279
Author: Stephen Leake <stephen_leake@stephe-leake.org>
Commit: Stephen Leake <stephen_leake@stephe-leake.org>
In path-iterator, fix header comment syntax, add Commentary
* packages/path-iterator/path-iterator.el: Fix comment syntax, add
Commentary.
(path-iter--to-truename): Rename with --; not part of public API.
---
path-iterator.el | 57 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 49 insertions(+), 8 deletions(-)
diff --git a/path-iterator.el b/path-iterator.el
index abfdff1..ca208e4 100644
--- a/path-iterator.el
+++ b/path-iterator.el
@@ -1,6 +1,6 @@
-;; path-iterator.el --- An iterator for traversing a directory path.
-*-lexical-binding:t-*-
+;;; path-iterator.el --- An iterator for traversing a directory path.
-*-lexical-binding:t-*-
-;; Copyright (C) 2015 - 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2015 - 2017, 2019 Free Software Foundation, Inc.
;;
;; Author: Stephen Leake <stephen_leake@stephe-leake.org>
;; Maintainer: Stephen Leake <stephen_leake@stephe-leake.org>
@@ -23,9 +23,50 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
-;;; Code:
+;;; Commentary:
-(require 'cl-generic)
+;; A path-iterator object is created by `make-path-iterator', which
+;; takes keyword arguments:
+;;
+;; user-path-non-recursive: list of directories to return, in order given
+;;
+;; user-path-recursive: list of root directory trees to return; trees
+;; are explored in depth-first order, after all directories in
+;; `user-path-non-recursive' are returned.
+;;
+;; ignore-function: a function that takes one argument (an absolute
+;; directory name), and returns nil if directory should be returned,
+;; non-nil if not.
+;;
+;; Other functions:
+;;
+;; path-iter-done: non-nil if the iterator is done (all directories
+;; have been returned).
+;;
+;; path-iter-next: return the next directory, or nil if done.
+;;
+;; path-iter-restart: restart iterator; next call to `path-iter-next'
+;; will return the first directory.
+;;
+;; path-iter-reset: clear internal caches; recompute the path. In
+;; normal operation, the directories returned from both the
+;; non-recursive and recursive path are cached in an array in the
+;; first iteration, and subsequent iterations just return items in
+;; that array. This avoids calling `directory-files' and the
+;; ignore-function on iterations after the first. `path-iter-reset'
+;; should be called if directories are added/deleted in the recursive
+;; path, or if the ignore-function is changed,
+;;
+;; path-iter-contains-root: non-nil if the iterator directory lists
+;; contain the given directory. For both the non-recursive and
+;; recursive lists, the given directory must be in the list; nested
+;; directories return nil.
+;;
+;; path-iter-expand-filename: expand a given filename against all the
+;; directories returned by the iterator, return the first one that
+;; exists, or nil if the filename exists in none of the directories.
+
+;;; Code:
(cl-defstruct
(path-iterator
@@ -38,9 +79,9 @@
user-path-recursive
ignore-function
&aux
- (path-non-recursive-init (path-iter-to-truename
user-path-non-recursive))
+ (path-non-recursive-init (path-iter--to-truename
user-path-non-recursive))
(path-non-recursive path-non-recursive-init)
- (path-recursive-init (path-iter-to-truename
user-path-recursive))
+ (path-recursive-init (path-iter--to-truename
user-path-recursive))
(path-recursive path-recursive-init)
(visited nil)
(current nil)
@@ -76,7 +117,7 @@
(member root (path-iter-path-non-recursive-init iter))
))
-(defun path-iter-to-truename (path)
+(defun path-iter--to-truename (path)
"Convert each existing element of PATH to an absolute directory file
truename,
return the resulting list. Elements of PATH are either absolute or
relative to `default-directory'.
@@ -245,4 +286,4 @@ Return a list of absolute filenames or nil if none found."
result))
(provide 'path-iterator)
-;; path-iterator.el ends here
+;;; path-iterator.el ends here.
- [elpa] branch externals/path-iterator created (now a981172), Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator b52f084 01/10: Add package path-iterator, version 0, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator df995c1 02/10: In path-iterator, fix header comment syntax, add Commentary,
Stefan Monnier <=
- [elpa] externals/path-iterator e266320 04/10: In path-iterator, add new function and test, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator a981172 10/10: * .gitignore: New file, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator a8f6f40 03/10: Improve uniquify-files; add tests. Add path-iterator tests, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator df6a5e2 09/10: Release path-iterator.el, uniquify-files.el, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator dc2e0cb 05/10: Improve path-iterator, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator e3a6a86 06/10: Improve path-iterator handline of duplicate directories, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator 0e59874 07/10: In uniquify-files, factor out file-complete.el, Stefan Monnier, 2020/12/01
- [elpa] externals/path-iterator 92c5173 08/10: In ada-mode, wisi; release ada-mode 6.1.1, wisi 2.1.1, Stefan Monnier, 2020/12/01