Announcing: vc-use-package

Posted on 2022-12-22  ·  2 min read  ·  emacs

I’d like to announce a small package I’ve written: vc-use-package. It is a first attempt at integrating the new (as of Emacs 29) package-vc.el with the now built-in use-package. I’ve already talked about how these two interact in my last post—you can see this package as automating things juuuust a little more.

Motivation

For the last post, someone gave me some feedback: couldn’t we go a little further? In particular, they wanted a new :vc keyword for use-package, much like quelpa has done with quelpa-use-package. I already gave them a small working example in a follow-up comment, but figured this might actually interest enough people so that turning it into a proper package could be worth it; and here we are!

The basic premise is really this simple—we create a handler for a new :vc use-package keyword. It can be used like so:
(use-package math-delimiters
  :vc (:fetcher github :repo oantolin/math-delimiters))

One can specify most arguments that package-vc-install also accepts; for example:
(use-package math-delimiters
  :vc (:fetcher "github"
       :repo "oantolin/math-delimiters"
       :rev "master"         ; also accepts the special `:last-release'
       :backend Git))

Much like quelpa-use-package, there is some care needed concerning the interaction between this package and the use-package-always-ensure variable, but this should mostly be taken care of automatically. For more information (and manual controls), see the README.

Conclusion

As I’ve said in the corresponding Reddit post, now that both package-vc.el and use-package are built-in, someone should really add this to Emacs proper. Alas, since I copied the idea and most of the initial implementation from quelpa-use-package—and thus copyright assignment is a bit iffy—it will not be me. Still, implementing this from scratch does not sound so hard. If anyone feels inspired to do exactly this, I’d be delighted!