-
Notifications
You must be signed in to change notification settings - Fork 13
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
Cask file organization #15
Comments
At present Pallet just rewrites the file on each change, but I see the value of your use case; we could try to do that a bit more intelligently. Could you post an example of how you lay out your Cask file? |
I had the same problem. My file was not very complicated, along those lines:
I did not care for the full rewrite, which added the url for melpa and removed the comments. In the emacs tradition, we could maybe define a |
As a minimal example, say I have
The alternative strategy would be something like
I sort of like this idea because it opens Pallet up to community-vetted packs ("crates"?) of related functionality. That may be outside the scope of Pallet, but it's an idea. |
@prooftechnique I like your second strategy better, I think. |
👍 |
It would be much simpler if Pallet just appended new dependencies at the end of |
Remember that the Cask-file is not an Emacs Lisp file. It is a configuration file, written in Lisp syntax. So we cannot add things such as functions in there. |
I think the best possible solution here is to have a "pallet packing zone" delimited by special comments as suggested by @dudebout. Any time pallet needs to edit something inside the packing zone, it is free to completely rearrange the zone if it wants to (i.e. keep things sorted alphabetically to minimize diffs). But outside the zone, it would just delete the expressions that it needed to and not modify anything else (this would happen if you were uninstalling a package that was listed outside the packing zone). Or there could be an option to never touch anything outside the packing zone. Unfortunately, looking at the code, something like this would probably require rewriting a lot of Pallet. Pallet loads the Cask file as a cask bundle object, which is just a data structure for dependencies and such, and is not intended to preserve formatting or comments. Basically, to make this happen, you would have to write your own parser for Cask files that preserves all the formatting, and supports in-place editing of elements. It's not impossible to do, but it might not be worth the effort. As an alternative, might I suggest letting Pallet handle your Cask file and instead organizing your packages using |
I may open a similar issue in Cask's tracker if it's more appropriate there, but I had a question/feature request for the way Pallet writes to the Caskfile. I like to put related packages in groups delimited by comments, but Pallet strips all of these when writing the Caskfile.
Would there be a way to respect this sort of system? Alternatively, I could define functions to serve the same purpose and call them at the end of the file (since it's just elisp), but I don't know if Pallet would respect this method of grouping either. Any thoughts?
The text was updated successfully, but these errors were encountered: