Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove unused packages from straight lockfile #1096

Open
mohkale opened this issue May 28, 2023 · 3 comments
Open

Do not remove unused packages from straight lockfile #1096

mohkale opened this issue May 28, 2023 · 3 comments
Labels

Comments

@mohkale
Copy link

mohkale commented May 28, 2023

Hi there,

In my Emacs config I often have several optional packages which I don't even install if I haven't enabled them for my current environment. It seems like straight removes the package version from the lockfile if I run straight-freeze-versions while that package is not available. Then when I re-enable the package it auto upgrades to the latest version. Would it be possible to retain packages whose versions have not changed in the lockfile instead of deleting them as if they've been permanently removed?

@raxod502
Copy link
Member

This is the purpose of straight-register-package. The intent is that if you have a conditional package, you always register, but may not invoke straight-use-package. It will then continue to be tracked in your configuration and lockfile, but not compiled or added to load-path.

@mohkale
Copy link
Author

mohkale commented Jul 20, 2023

I don't think this is very practical with the way my config is setup. I basically have to generate a complete list of all dependencies ahead of time and then register them. That or update each individual package so alongside an optionally evaluated use-package block I have an explicit straight-register block. Do you have any suggestions for other projects might be going about this 🤔. I'm aware doom just seems to lock in the use-package block directly but is there a less grindy approach you could recommend. Personally I don't see why this wouldn't behave just like the straight repos directory. You only remove things when the user chooses to prune them out, otherwise keep everything in a stable state.

@raxod502
Copy link
Member

raxod502 commented Aug 2, 2023

Well, the current implementation assumes that all packages are available in order to compute dependencies and the lockfile. We could add support for not pruning the lockfile as aggressively, but it wouldn't be a full solve: the lockfile generation would still prune undeclared packages.

Doom essentially implements its own package management layer on top of straight.el. This isn't really what I recommend, but I can't fault the author; straight.el is lacking the features that are needed to implement what Doom wants.

That or update each individual package so alongside an optionally evaluated use-package block I have an explicit straight-register block.

You could configure your use-package so that it evaluates the straight-register-package form unconditionally, but only straight-use-package if your conditional form passes. That should be reasonably straightforward, I think.

I understand why this feels like a hack to you: it's because the current implementation of straight.el depends on some assumptions about what data is available. I have no objection to changing that, but it requires a fair bit of work which I have not (as of yet) undertaken to make the conceptual model more powerful so it can support more intelligent lockfile management. Nonetheless, I think the conditional straight-register-package approach is the best thing that exists today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants