Skip to content

Instantly share code, notes, and snippets.

@emanon-was
Created December 29, 2015 03:27
Show Gist options
  • Select an option

  • Save emanon-was/0fe0e52a5b9ab0347c1d to your computer and use it in GitHub Desktop.

Select an option

Save emanon-was/0fe0e52a5b9ab0347c1d to your computer and use it in GitHub Desktop.
;;-----------------------------
;; Load *.config.el
;;-----------------------------
(defvar loaded-config '())
(defun config-el-p (conf)
(string-match "\\.config\\.el$" conf))
(defun loaded-config-p (conf)
(if (config-el-p conf)
(member conf loaded-config)
nil))
(defun load-config-file (conf)
(if (and (config-el-p conf)
(not (loaded-config-p conf)))
(progn
(load conf)
(setq loaded-config
(nconc loaded-config
(list conf))))))
(defun load-config-directory (path)
(let* ((path (expand-file-name path))
(files (directory-files path)))
(dolist (x files)
(load-config-file x))))
(defun load-configs (path)
(load-config-directory
(locate-user-emacs-file path)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment