diff options
author | Karl Heuer <[email protected]> | 1998-03-23 00:15:20 +0000 |
---|---|---|
committer | Karl Heuer <[email protected]> | 1998-03-23 00:15:20 +0000 |
commit | 859e15c1e5260f5bc35c27c331f3b412fee587c1 (patch) | |
tree | b9be02a95ae0a5541277ebfacbc600e1dcaac70b /lisp | |
parent | 2fa149b63f8004c8393a0f59f1eb85acc7a88c43 (diff) |
(normal-top-level-add-subdirs-to-load-path): New function.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/startup.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index a578623938..920fe71737 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -333,6 +333,26 @@ from being initialized." (defvar init-file-had-error nil) +(defun normal-top-level-add-subdirs-to-load-path () + "Add all subdirectories of current directory to `load-path'." + (let (dirs + (pending (list default-directory))) + ;; This loop does a breadth-first tree walk on DIR's subtree, + ;; putting each subdir into DIRS as its contents are examined. + (while pending + (setq dirs (cons (car pending) dirs)) + (setq pending (cdr pending)) + (let ((contents (directory-files (car dirs))) + (default-directory (car dirs))) + (while contents + (unless (member (car contents) + '("." ".." "RCS")) + (when (file-directory-p (car contents)) + (setq pending (nconc pending + (list (expand-file-name (car contents))))))) + (setq contents (cdr contents))))) + (normal-top-level-add-to-load-path dirs))) + ;; This function is called from the subdirs.el file. (defun normal-top-level-add-to-load-path (dirs) (let ((tail load-path) |