Subject: bug#59226: 29.0.50; unable to load package-vc.el if package-vc-selected-packages is non-nil

From: Philip Kaludercic <[email-masked]>
Date: Sun, 20 Nov 2022 11:57:36 +0000

Richard Kim <[email-masked]> writes:

> Spacemacs <https://github.com/syl20bnr/spacemacs> is one large emacs
> setup designed to be the initialization code, i.e., emacs
> --init-directory spacemacs-directory.  It uses use-package to install
> typically hundreds of packages.
>
> straight.el <https://github.com/radian-software/straight.el> is an
> alternative to package.el where packages are installed by cloning git
> (or other) repositories and building packages from source directly.
> This is similar to package-vc.el. The key difference is that the git
> clone directories are not added to load-path. Rather a new directory
> is created where symlinks to *.el files are used plus byte compiled
> files, e.g., following would be added to load-path:
>
>     $ cd .../spacemacs/.local/straight/build-29.0-102921/dash/
>     $ ls -l
>     total 360
>     -rw-rw-r-- 1 kimr kimr   2936 Oct 29 22:04 dash-autoloads.el
>     lrwxrwxrwx 1 kimr kimr     63 Oct 29 22:04 dash.el ->
> /home/kimr/.emacs.d/sm-ms/.local/straight/repos/dash.el/dash.el
>     -rw-rw-r-- 1 kimr kimr 147632 Oct 29 22:04 dash.elc
>     -rw-rw-r-- 1 kimr kimr 198812 Oct 29 22:04 dash.info
>     lrwxrwxrwx 1 kimr kimr     65 Oct 29 22:04 dash.texi ->
> /home/kimr/.emacs.d/sm-ms/.local/straight/repos/dash.el/dash.texi
>     -rw-rw-r-- 1 kimr kimr    617 Oct 29 22:04 dir
>     $

Thanks for this explanation, I wasn't familiar with this detail.

> I have an update to my previous email. I think I'm understanding
> better how package-vc is supposed to work. So please disregard my
> previous question on activation. Instead I would like to share that
> package-vc seems to work fine except for packages that house *.el
> files within a sub-directory, e.g., magit or git-commit packages which
> use lisp sub-directories. For these packages I either have to install
> magit package using package.el (even though I installed it via
> package-vc) or I would have to manually add the lisp sub-directory to
> load-path in my startup file. If I do that, then magit and git-commit
> packages installed via package-vc work.  Following is what I currently
> have in my startup file to be able to use package-vc installed magit
> and git-commit packages.
>
>     (add-to-list 'load-path "~/.emacs.d/sm-my/elpa/29.0/site/git-commit/lisp")
>     (add-to-list 'load-path "~/.emacs.d/sm-my/elpa/29.0/site/magit/lisp")

This _is_ handled, if the package specification has a `:lisp-dir' entry
pointing to the right directory.  If I had to guess, I'd say you are
using MELPA and it is probably the first entry in `package-archives'?
If so, the issue would be that MELPA doesn't provide any public package
specifications, the way GNU ELPA and NonGNU ELPA do.

What is probably required is some kind of a heuristic to detect a lisp
directory, but I haven't come up with a good solution to that yet.

> In my typical spacemacs setup, I have between 300 and 400 hundred
> packages installed. I think more than half were installed via
> package-vc and rest were installed via pacakge.el. I'm trying to see
> if I can use package-vc to install all packages.

It would be possible in theory, but note that package-vc installs
dependencies using regular tarballs installations.