diff options
| author | Richard M. Stallman | 1998-05-11 01:17:48 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-11 01:17:48 +0000 |
| commit | 0412d833601f074eb6b39cfdb298e098eff69f3c (patch) | |
| tree | cdf7250557c3df2769ec898a2efb2cc43e9627af | |
| parent | b69f979760fd5cabff5eb36171aefae3f933be2c (diff) | |
| download | emacs-0412d833601f074eb6b39cfdb298e098eff69f3c.tar.gz emacs-0412d833601f074eb6b39cfdb298e098eff69f3c.zip | |
(normal-top-level-add-subdirs-to-load-path):
Ignore subdirectories whose names start with nonalphanumeric
or that have a file called .nosearch.
| -rw-r--r-- | lisp/startup.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index ee7227aa1e9..1a85a2aa0be 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -334,7 +334,10 @@ from being initialized." | |||
| 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, |
| @@ -345,11 +348,13 @@ from being initialized." | |||
| 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 | ||