-
Notifications
You must be signed in to change notification settings - Fork 151
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
Changing recipe in init file doesn't load new recipe for a package #166
Comments
I think I've noticed this as well - if you call |
Yeah exactly. In fact, I don't even think there should be a prompt and it should 'just work'. For example, if I didn't have general installed previously, and just put the second code snippet in my init.el, then general gets installed and is on the buttercup branch. So I expect the same result if I have the same thing in my init.el. But to have a prompt would mean different behaviour based on some previous state (i.e. the fact that I installed general beforehand with default recipe), and so the init file is no longer the sole source of truth. |
This is expected behavior. Otherwise, it would not be possible to switch branches without updating the recipe in your init-file. Furthermore, it would be impossible to guarantee a fast startup if it were necessary to invoke The idea is that your init-file specifies a single source of truth, which may have arbitrary local modifications applied on top of it. To revert those local modifications, use See also #103 (comment) for more discussion. In your case @vyp, you would want to I'm open to suggestions on ways in which the user experience or documentation could be improved in this area. |
Yeah so after I made my last comment, I was thinking that requiring such a check at every startup would be way too costly in terms of performance, but then if I for example enter a new package in my init.el, then straight does install it at the next startup, so what's going on here? How does straight do this without being slow, is it a simple case of checking if the local repo exists? (I know can just look at the source code, but thought I might ask as well.) re: local modifications, I thought about this, and I think the ability to load the local state of the directory is nice and like the way you designed it to be used. For example, even if it's not completely deterministic from the init file, it can be made deterministic pretty easily, and plus this way there's no overhead to just experimenting with quick (or long) arbitrary changes, sort of the way emacs is supposed to be.
So for me it wasn't clear that I had to use I'm not sure how to address that in the documentation though, but does that help? Maybe, a comment somewhere saying |
In other words, the whole reason I made this package manager.
Agreed, this is not made clear in the README.
It's because there's no way to distinguish a recipe change from a local modification, or some combination of both.
Good idea. This should be made obvious, since it only makes immediate sense from the developer's perspective (i.e. mine), and not the user's.
Let's leave it open to track the documentation improvements. |
Is this actually documented somewhere? I looked/tried for about 10 minutes how to switch from original package to my fork, and ended up just adding the remote manually. I don't really understand the information in this thread either, it seems to me that adding :fork t and then normalizing the package is suggested, but that didn't do anything it seems. (not even fetching afterwards) :/ |
Adding In terms of documentation, I think the information is technically available in the README, but not all in one place like is necessary to understand it holistically. Sorry, I feel bad for creating such a complex system. |
I'm wondering if there's a way to get the best of both worlds here: to maintain the quick startup, but also notice when a recipe changes and update the installed package automatically. I'm not familiar enough with how the local modification scenario works to understand the data loss concern well, but my feeling is that if you manually edit the local repo, and then change the recipe in the init file, you shouldn't be surprised if the local repo gets checked out again and you lose your unsaved local modifications (but this case can be handled more gracefully with a little more work). My assumption is that network-based Git operations are too expensive to perform in the common, needs-to-be-fast case, but that checking for the existence of files or reading small text files is OK. So, why not have a file -- let's call it Now, this simple approach will overwrite any local changes the user made to the local package repo, but as I said that I don't think that would be a big surprise, since it's in response to the user changing the recipe. But of course accidental data loss is not fun, and it seems easy enough recognize this case and tell the user: when an updated recipe is detected, via a difference between the user's init file and It would in theory be possible to only warn when the user has actually made local modifications to the local package, but I don't think it's worth the trouble in general, given that you support a lot of different backends, and for non VC backends you might have to go "full nix" to detect these modifications. But in the case of the Git backend, which I assume covers 99% of practical usage, it would be easy to additionally cache which commit was checked out for the old recipe listed in |
There are plenty of ways to modify a package recipe for which one would not want to lose their local repo modifications. |
What you're suggesting is very plausible without the need for tradeoffs around data loss, because |
I'm using straight.el (master branch) with use-package and have the following in my
init.el
:Which works, general gets installed. But now I want to use a different branch for that package, so I change the second line to:
Now when I quit and relaunch emacs, I don't think I see any new effect, general is still on the default master branch, not buttercup. I may have missed it in the docs, but is this expected behaviour?
The text was updated successfully, but these errors were encountered: