Manage Your Own Package in Spacemacs
How to manage your own package or the one your forked in Spacemacs? The answer is the layer.
Create your layer
M-x
+configuration-layer/create-layer
- select
~/.spacemacs.d
- The layer
<layerName>
is created withpackages.el
and/orREADME.org
(depends on your choice). - add your layer
<layerName>
into the variabledotspacemacs-configuration-layers
in~/.spacemacs.d/init.el
Manage your packages in packages.el
packages.el
contains a list of packages and their configuaration functions (init, post-init, etc...)- Add your packages into
packages.el
following the grammar in the documentation- Spacemacs supports different recipes to install a package. For managing our own package, we need to maintain it locally instead of remotely. This way, you would be able to debug and make sure it is working before your push it.
- For local multi-file package, one has to use
1
(package-name :location (recipe :fetcher local))
- Initialize the package by adding
1
2
3
4(defun layerName/init-packageName ()
(use-package packageName
:init)
) - IMPORTANT: Multi-file local package is not supported yet byf the stable version Spacemaces. To make it work, one has to follow the issues #8718 and fix the corresponding files. Otherwise, clone the develop branch.
- Local packages should reside at
<layerName>/local/<packageName>
, git repository can be created within this folder. - See Configuration layers for more details