diff options
| author | Karl Heuer | 1998-03-23 00:15:20 +0000 |
|---|---|---|
| committer | Karl Heuer | 1998-03-23 00:15:20 +0000 |
| commit | 859e15c1e5260f5bc35c27c331f3b412fee587c1 (patch) | |
| tree | b9be02a95ae0a5541277ebfacbc600e1dcaac70b | |
| parent | 2fa149b63f8004c8393a0f59f1eb85acc7a88c43 (diff) | |
| download | emacs-859e15c1e5260f5bc35c27c331f3b412fee587c1.tar.gz emacs-859e15c1e5260f5bc35c27c331f3b412fee587c1.zip | |
(normal-top-level-add-subdirs-to-load-path): New function.
| -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 a5786239380..920fe717377 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -333,6 +333,26 @@ from being initialized." | |||
| 333 | 333 | ||
| 334 | (defvar init-file-had-error nil) | 334 | (defvar init-file-had-error nil) |
| 335 | 335 | ||
| 336 | (defun normal-top-level-add-subdirs-to-load-path () | ||
| 337 | "Add all subdirectories of current directory to `load-path'." | ||
| 338 | (let (dirs | ||
| 339 | (pending (list default-directory))) | ||
| 340 | ;; This loop does a breadth-first tree walk on DIR's subtree, | ||
| 341 | ;; putting each subdir into DIRS as its contents are examined. | ||
| 342 | (while pending | ||
| 343 | (setq dirs (cons (car pending) dirs)) | ||
| 344 | (setq pending (cdr pending)) | ||
| 345 | (let ((contents (directory-files (car dirs))) | ||
| 346 | (default-directory (car dirs))) | ||
| 347 | (while contents | ||
| 348 | (unless (member (car contents) | ||
| 349 | '("." ".." "RCS")) | ||
| 350 | (when (file-directory-p (car contents)) | ||
| 351 | (setq pending (nconc pending | ||
| 352 | (list (expand-file-name (car contents))))))) | ||
| 353 | (setq contents (cdr contents))))) | ||
| 354 | (normal-top-level-add-to-load-path dirs))) | ||
| 355 | |||
| 336 | ;; This function is called from the subdirs.el file. | 356 | ;; This function is called from the subdirs.el file. |
| 337 | (defun normal-top-level-add-to-load-path (dirs) | 357 | (defun normal-top-level-add-to-load-path (dirs) |
| 338 | (let ((tail load-path) | 358 | (let ((tail load-path) |