shelper
shelper

Reputation: 10583

emacs for submodule of installed package that hosted on github

I have installed emacs on several computers, and to sync the configurations between them, i setup a github repo that stores my emacs configurations, i.e., my folder ~/.emacs.d

now, i started to use emacs on one computer, i installed certain package, lets say, package_foo, using MELPA. Now there is a folder called package_foo in my .emacs.d/elpa foder. i also found the package_foo actually is actually hosted on github. it would be great if i can submodule it because my .emacs.d is on github as well.

so if package_foo i installed by emacs package manager is on github, how can i submodule it automatically instead of copy it to my .emacs.d/elpa folder? Is there an emacs plugin that knows the source of package_foo, and submodule it for installation (if possible) instead of pulling all files? That can not only save space on github, but also save my bandwidth when syncing.

Upvotes: 0

Views: 371

Answers (1)

user355252
user355252

Reputation:

Don't use submodules for packages. Don't commit packages to your repository.

Instead, configure Emacs to automatically install missing packages for you. You can either use some special function for this purpose:

(defun package-required (package) (unless (package-installed-p package) (package-install package))

(package-required 'magit)

Or you can use Carton to manage your packages by declaring them in a Carton file. Then you can use the shell commands carton install to install missing packages, and carton update to update all packages.

Upvotes: 2

Related Questions