I'm trying to create a layer where one package in the layer depends on the functionality of another package in the same layer. As spacemacs loads the packages alphabetically (I assume) this only works if the dependend package has a name that is loaded after the name of the package with the required functionality - otherwise it doesn't compile. Minimal example:
emacs/private/testlayer
- packages.el
- local
- a-package
a-package.el
- b-package
b-package.el
Where packages.el
:
;; the order of the arguments in the package-list doesn't matter
;; for the loading process
(defconst testlayer-packages
'((a-package :location local)
(b-package :location local))
)
;; the order of the init functions in the file doesn't matter
;; for the loading process
(defun testlayer/init-a-package ()
(use-package a-package)
)
(defun testlayer/init-b-package ()
(use-package b-package)
)
and a-package.el
:
(require 'b-package)
(defun a-pack-fun ()
(b-pack-fun)
)
(provide 'a-package)
and b-package.el
:
(defun b-pack-fun ()
(message "b-pack-fun")
)
(provide 'b-package)
Adding testpackage
to dotspacemacs-configuration-layers
in .spacemacs
and trying to load it results in the following error message:
Warning (initialization): An error occurred while loading
`/home/user/.emacs.d/init.el':
File error: Cannot open load file, no such file or directory, b-package
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
If the dependencies are the other way around (b-package
calls functionality from a-package
) everything works just fine due to the alphabetical loading order.
Now, how can I specify the loading order so that b-package
is loaded before a-package
?