Mercurial > emacs
comparison lisp/startup.el @ 22024:bf37812dd6bb
(normal-top-level-add-subdirs-to-load-path):
Ignore subdirectories whose names start with nonalphanumeric
or that have a file called .nosearch.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 11 May 1998 01:17:48 +0000 |
parents | ef39b27c5e20 |
children | 9b0a64c31e1c |
comparison
equal
deleted
inserted
replaced
22023:8c00a2d112cc | 22024:bf37812dd6bb |
---|---|
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 | 335 |
336 (defun normal-top-level-add-subdirs-to-load-path () | 336 (defun normal-top-level-add-subdirs-to-load-path () |
337 "Add all subdirectories of current directory to `load-path'." | 337 "Add all subdirectories of current directory to `load-path'. |
338 More precisely, this uses only the subdirectories whose names | |
339 start with letters or digits; it excludes any subdirectory named`RCS', | |
340 and any subdirectory that contains a file named `.nosearch'." | |
338 (let (dirs | 341 (let (dirs |
339 (pending (list default-directory))) | 342 (pending (list default-directory))) |
340 ;; This loop does a breadth-first tree walk on DIR's subtree, | 343 ;; This loop does a breadth-first tree walk on DIR's subtree, |
341 ;; putting each subdir into DIRS as its contents are examined. | 344 ;; putting each subdir into DIRS as its contents are examined. |
342 (while pending | 345 (while pending |
343 (setq dirs (cons (car pending) dirs)) | 346 (setq dirs (cons (car pending) dirs)) |
344 (setq pending (cdr pending)) | 347 (setq pending (cdr pending)) |
345 (let ((contents (directory-files (car dirs))) | 348 (let ((contents (directory-files (car dirs))) |
346 (default-directory (car dirs))) | 349 (default-directory (car dirs))) |
347 (while contents | 350 (while contents |
348 (unless (member (car contents) | 351 (unless (member (car contents) '("." ".." "RCS")) |
349 '("." ".." "RCS")) | 352 (when (and (string-match "\\`[a-zA-Z0-9]" (car contents)) |
350 (when (file-directory-p (car contents)) | 353 (file-directory-p (car contents))) |
351 (setq pending (nconc pending | 354 (let ((expanded (expand-file-name (car contents)))) |
352 (list (expand-file-name (car contents))))))) | 355 (unless (file-exists-p (expand-file-name ".nosearch" |
356 expanded)) | |
357 (setq pending (nconc pending (list expanded))))))) | |
353 (setq contents (cdr contents))))) | 358 (setq contents (cdr contents))))) |
354 (normal-top-level-add-to-load-path (cdr (nreverse dirs))))) | 359 (normal-top-level-add-to-load-path (cdr (nreverse dirs))))) |
355 | 360 |
356 ;; This function is called from the subdirs.el file. | 361 ;; This function is called from the subdirs.el file. |
357 (defun normal-top-level-add-to-load-path (dirs) | 362 (defun normal-top-level-add-to-load-path (dirs) |