AFAIK, there is no 'proper' way of doing this. What I use in such cases is not load
but require
. Every private layer that has such configurations files (features / packages) has a folder named extra
. And I just add that folder to load path using add-to-load-path
. After that I use require
to load configurations inside of :config
just like you use load
.
I understand that this might sound like a total overhead, but Spacemacs is about lazy loading and such approach doesn't break this principle. If you don't care about lazy loading - you can force load org and configure without any indentations.
Also, it's pretty easy to automate the step where you add extra
folder to load-path
using following snippet.
(defun d12-layers/add-extra-to-load-path (layer)
"Add 'extra' folder to `load-path' for a given LAYER.
Load-path is modified only when such folder exists."
(let* ((layer-path (configuration-layer/get-layer-path layer))
(layer-root (format "%s%s/" layer-path layer))
(extra-path (concat layer-root "extra/")))
(when (file-exists-p extra-path)
(add-to-load-path extra-path))))
(mapc #'d12-layers/add-extra-to-load-path (configuration-layer/get-layers-list))
This saves you from using layer name somewhere except of list of layers.
Updated
Forgot to say, how to use this. Just put declaration of d12-layers/add-extra-to-load-path
function somewhere in .spacemacs
or $SPACEMACSDIR/init.el
(based on what you're using) and then place following snippet in your dotspacemacs/user-init
function:
(configuration-layer//declare-layers)
(mapc #'d12-layers/add-extra-to-load-path
(configuration-layer/get-layers-list))
I understand that using 'private' configuration-layer//declare-layers
function is far from good, but it's better to setup load-path
before layers are loaded, so we can require
in config.el
and funcs.el
.