Next: , Previous: , Up: Bootstrapping   [Contents][Index]


2.2.2 Bootstrapping from scratch

If you don’t want to base your configuration on the emacs.g starter-kit described in the previous section, then you have to do a few things manually.

git init ~/.emacs.d
cd ~/.emacs.d

By default Borg installs packages inside the lib/ subdirectory, but since you are starting from scratch, you may choose something else by setting the Git variable borg.drones-directory locally for this repository.

Then you should add a Makefile containing at least:

DRONES_DIR = $(shell git config "borg.drones-directory" || echo "lib")

-include $(DRONES_DIR)/borg/borg.mk

bootstrap-borg:
        @git submodule--helper clone --name borg --path $(DRONES_DIR)/borg \
        --url git@github.com:emacscollective/borg.git
        @cd $(DRONES_DIR)/borg; git symbolic-ref HEAD refs/heads/master
        @cd $(DRONES_DIR)/borg; git reset --hard HEAD

Now you are probably tempted to run make bootstrap-borg, but that is for bootstrapping from a seed, and what we are doing right now is to bootstrap from scratch. In the process we are creating a seed but we are not there yet. Instead run this:

git submodule add --name borg git@github.com:emacscollective/borg.git lib/borg

Now that borg is available we can build all the assimilated packages (currently just borg itself) using make bootstrap.

Now it is time to tell Emacs to initialize Borg instead of Package by adding a simple init.el file containing at least:

(when (< emacs-major-version 27)
  (setq package-enable-at-startup nil))
(add-to-list 'load-path (expand-file-name "lib/borg" user-emacs-directory))
(require 'borg)
(borg-initialize)

Beginning with Emacs 27.1, package-enable-at-startup has to be disabled earlier, in early-init.el:

(setq package-enable-at-startup nil)

Now you could create the initial commit but you could also delay that.

git commit -m "Assimilate borg"

Now it is time to assimilate some other essential packages. You could do so using M-x borg-assimilate, but you would quickly notice that doing so without the help of the epkg package is quite cumbersome, so lets manually install that and its dependency first:

git submodule add --name closql git@github.com:emacscollective/closql.git lib/closql
git submodule add --name emacsql git@github.com:skeeto/emacsql.git lib/emacsql
git submodule add --name epkg git@github.com:emacscollective/epkg.git lib/epkg
git config -f .gitmodules submodule.emacsql.no-byte-compile emacsql-pg.el
echo /epkgs/ >> .gitignore
git add .gitignore .gitmodules
make all
git commit -m "Assimilate epkg and dependencies"

Once you have done that and restarted Emacs, then you can Magit using Borg as described in Assimilation. As part of that you should tell Magit status buffers to display submodules:

(with-eval-after-load 'magit
  (magit-add-section-hook 'magit-status-sections-hook
                          'magit-insert-modules
                          'magit-insert-stashes
                          'append))

Finally (look, nobody forced you to do this from scratch ;-) I strongly suggest that you make yourself familiar with my auto-compile package.


Next: , Previous: , Up: Bootstrapping   [Contents][Index]