-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
More flexible additional packages #3034
Conversation
I hear you, currently overriding a location is very cumbersome. I think that with a little hack we could use |
Actually, that wouldn't be difficult at all. The additional packages are already loaded last. All we have to do is add a check for |
5301fbb
to
a8d2d7e
Compare
Updated with new suggestion. It's quite a bit simpler. |
Is the new location required ? I find it confusing if it is required for what we want to achieve here. I would have worked at the owner level instead https://github.com/TheBB/spacemacs/blob/override-locations/core/core-configuration-layer.el#L338, i.e. if there is already a owner then don't override it to |
I don't see why |
No, the location is optional. I was just trying to not break any existing configs: if you add helm (say) as an additional package the owner will be changed. But we can break backwards compatibility, if you want. |
When the package already exists, use configuration-layer/make-package to copy information into the existing package object. This allows overwriting location, step and excluded, but NOT owner, pre-layers or post-layers. This also adds a new valid location attribute called `local-dotfile`. This is an implementation detail, to distinguish local packages (in layers) from packages which have their location overridden to local. This is based on the assumption that the source code in the latter case should not be found in a subdirectory of the owning layer, but somewhere else entirely. For those packages, `.emacs.d/local/<pkg-name>` will be added to the load path.
a8d2d7e
to
5ad0335
Compare
I have updated again. See OP for how this currently works. |
You understand the intricacies of core much better than I do. I had some problems when trying this out on a couple of packages, but maybe I was just doing it wrong. I think the basic mechanism is correct, though. |
Your implementation for the owner is flawless. I removed the part for local-dotfile because we just have to check if the package has a |
Great. I'm not sure I get it though. If a layer has a package whose location is local, the load path will be Of course, what we can do is just to add some other path to the load path for all local packages, since a missing path is not a problem. |
I think this is a rule to add in the same function as what was merged: if the |
Thinking about it, it is better to make it explicit with a new location but I would not bring the dotfile in the location name, we could use the So I propose to add a Sorry to make you re-implement the same kind of stuff... |
But in practice people will use a github recipe to achieve this ;-) But it is a good option to have, nice catch 👍 |
Gotcha, I like the private solution. |
Edit: This PR has been through a couple of design iterations, so the discussion may not make sense. The OP is current.
This might be a little contentious, but I had some spare time and figured that it wouldn't be so difficult to do... so...
Upstream
sometimesoften breaks. Even though we have made great leaps towards package version pinning, we're still a good ways off from doing it efficiently on a large scale. On the other hand, it's easy to do locally on a user level: just edit the relevantpackages.el
with a recipe. Then again, any solution for end users that involves editing the Spacemacs source code smells illegitimate to me.This streamlines the approach by using
configuration-layer/make-package
when going throughdotspacemacs-additional-packages
to copy information into the existing package object if it exists. This effectively means that thelocation
,step
andexcluded
slots become overridable, but theowner
,pre-layers
andpost-layers
slots do not.Details
This also adds a new valid location attribute called
local-dotfile
. This is an implementation detail, to distinguish local packages (in layers) from packages which have their location overridden to local. This is based on the assumption that the source code in the latter case should not be found in a subdirectory of the owning layer, but somewhere else entirely. For those packages,.emacs.d/local/<pkg-name>
will be added to the load path.Unintended goodies
In its current state, this PR allows us to deprecate
dotspacemacs-excluded-packages
since the same effect can be obtained with(pkg-name :excluded t)
indotspacemacs-additional-packages
, which nicely mirrors how layer package lists work.