caenix/modules/home/caem/development/emacs/emacs.d/rei.el
2025-02-21 17:28:19 +01:00

13 lines
539 B
EmacsLisp

(provide 'rei)
(defun rei/load (path)
"Load a configuraion file relative to the current file.
When the specified path is a directory it will look for a init.el file to load."
(when load-file-name
(let ((fp (file-name-concat (file-name-directory load-file-name) path)))
(if (file-directory-p fp)
(let ((fdp (file-name-concat fp "init.el")))
(if (file-exists-p fdp)
(load fdp)
(error "Cannot load %s directory as it's missing an init.el file." path)))
(load fp)))))