don't add to "load-path" any directory contains ".nosearch" file
This commit is contained in:
1 file changed
+6
-2
@@ -9,13 +9,17 @@
|
|||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'subr-x)
|
(require 'subr-x)
|
||||||
|
|
||||||
(defun add-dir-and-subdirs-to-load-path (dir)
|
(cl-defun add-dir-and-subdirs-to-load-path (dir)
|
||||||
"Add directory and its subdirectoris to `load-path'.
|
"Add directory and its subdirectoris to `load-path' when no `.nosearch' file exists in DIR.
|
||||||
Detect whether there are any loadable module in DIR, if so, add DIR to `load-path'.
|
Detect whether there are any loadable module in DIR, if so, add DIR to `load-path'.
|
||||||
Do this recursively for subdirectories of DIR."
|
Do this recursively for subdirectories of DIR."
|
||||||
(unless (file-directory-p dir)
|
(unless (file-directory-p dir)
|
||||||
(error "%s is not a directory" dir))
|
(error "%s is not a directory" dir))
|
||||||
|
|
||||||
|
;; if a `.nosearch' file exists in dir, skip it directly
|
||||||
|
(when (file-exists-p (expand-file-name ".nosearch" dir))
|
||||||
|
(cl-return-from add-dir-and-subdirs-to-load-path))
|
||||||
|
|
||||||
(let ((subdirs nil)
|
(let ((subdirs nil)
|
||||||
(files nil)
|
(files nil)
|
||||||
(temp-filepath nil)
|
(temp-filepath nil)
|
||||||
|
|||||||
Reference in new issue
Block a user