Last active
December 14, 2015 10:29
-
-
Save pkkm/5072706 to your computer and use it in GitHub Desktop.
Recursively load all Elisp files in a directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun load-recursively (dir-to-load &optional exclude-list) | |
"Load all .el files in DIR-TO-LOAD and its subdirectories (and their subdirectories, ...). | |
Exclude files (or directories) that are in EXCLUDE-LIST." | |
(let ((excluded-file-names (append exclude-list '("." "..")))) | |
(dolist (file (directory-files dir-to-load 'absolute-file-names)) | |
(unless (member (file-relative-name file dir-to-load) excluded-file-names) | |
(cond | |
((file-directory-p file) (load-recursively file exclude-list)) | |
((string= (file-name-extension file) "el") (load file))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment