Mercurial > emacs
comparison lisp/startup.el @ 21264:9eb6fcceba90
(normal-top-level-add-subdirs-to-load-path): New function.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 23 Mar 1998 00:15:20 +0000 |
parents | c67b70bc40d9 |
children | 5d62016adafd |
comparison
equal
deleted
inserted
replaced
21263:4a9b37818fac | 21264:9eb6fcceba90 |
---|---|
330 :group 'auto-save) | 330 :group 'auto-save) |
331 | 331 |
332 (defvar init-file-debug nil) | 332 (defvar init-file-debug nil) |
333 | 333 |
334 (defvar init-file-had-error nil) | 334 (defvar init-file-had-error nil) |
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))) | |
335 | 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) |
339 (thisdir (directory-file-name default-directory))) | 359 (thisdir (directory-file-name default-directory))) |