emacscollective / borg

Assimilate Emacs packages as Git submodules
https://emacsmirror.net/manual/borg
GNU General Public License v3.0
259 stars 28 forks source link

How can I use borg when I've already use submodule to manage my package? #92

Closed dalugm closed 4 years ago

dalugm commented 4 years ago

Before I find this package, I just use magit to add packages into .emacs.d/lib/site-lisp by submodule, and push the dir to my load-path. Here is my init-package.el's some code:

(unless (bound-and-true-p package--initialized) ; To avoid warnings in 27
  (setq package-enable-at-startup nil))

;;* Site-lisp
(defvar my-site-lisp-dir (expand-file-name "site-lisp" my-library-dir)
  "The packages.")

;; Load path
(let ((default-directory (file-name-as-directory my-site-lisp-dir)))
  (push default-directory load-path)
  (normal-top-level-add-subdirs-to-load-path))

;; borg {{{
(require 'borg)
(setq borg-user-emacs-directory my-emacs-d
      borg-drone-directory my-site-lisp-dir
      borg-gitmodules-file (expand-file-name ".gitmodules" my-emacs-d))
(borg-initialize)
;; }}} borg

;; epkg {{{
(require 'epkg)
;; }}} epkg

And I have use git subtree to add epkgs in my .emacs.d.

According to the manual, if I want to add new package I need to use borg-assimilate(right?), but it turns out like this. How can I solve it? Thanks!

(12:05:37) Building auto-compile

Initializing drones...done (0 drones in 0.003s)
 Creating /Users/mou/.emacs.d/lib/lib/auto-compile/auto-compile-autoloads.el...
Opening output file: No such file or directory, /Users/mou/.emacs.d/lib/lib/auto-compile/auto-compile-autoloads.el

Process emacs ... --eval (borg-build "auto-compile") exited abnormally with code 255

As the above code, I have set borg-drone-directory to .emacs.d/lib/site-lisp. But the package auto-compile installed by borg-assimilate is installed to .emacs.d/lib/lib/auto-compile, how can I solve this?

And why the xxx-autoloads.el can't be auto generated since I have add (borg-initialize)? The xxx-autoloads.el file won't be generated even when I press C-x C-e after (borg-initialize) even though the *Message* buffer show "Initializing drones...done (105 drones in 0.105s)"

tarsius commented 4 years ago

The location where modules are placed is currently hardcoded to <top-level>/lib/<module>. If you manually moved all the modules to these locations, then things should work. Or you could wait until I lift that restrictions but I don't know when I will get around to doing that yet. Beginning of August probably.

dalugm commented 4 years ago

hardcoded to /lib/

So borg-drone-directory doesn't work now?

Well, if I move all the packages to .emacs.d/lib, it means I have to change .gitmodules and .git/modules(right?)

So is it better reconfig my .emacs.d?

tarsius commented 4 years ago

Well, if I move all the packages to .emacs.d/lib, it means I have to change .gitmodules and .git/modules(right?)

If you use git mv to do that, I would expect Git to take care of updating these things for you.

So is it better reconfig my .emacs.d?

I would recommend you first try without restarting from scratch.

dalugm commented 4 years ago

Well, if I move all the packages to .emacs.d/lib, it means I have to change .gitmodules and .git/modules(right?)

If you use git mv to do that, I would expect Git to take care of updating these things for you.

So is it better reconfig my .emacs.d?

I would recommend you first try without restarting from scratch.

Thanks for your reply, I will give it a try.

dalugm commented 4 years ago

So (borg-initialize) will add moudules' name in .gitmodules to load-path (this costs me sometime because I didn't specify --name when using git submodules in my config...)

Now it works fine, thank you for developing such an awesome package♥️️

Btw, if I want to use a commit of a package, can I use the method described here while not confusing borg?

tarsius commented 4 years ago

Btw, if I want to use a commit of a package, can I use the method described here while not confusing borg?

Yes of course.

dalugm commented 4 years ago

Yes of course.

I got it, thanks for your reply😃

After use this package, my emacs start-up time has speed up a lot. Thanks!