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

can't easily extend sets in option maps #4

Closed
kkinnear opened this issue Dec 9, 2016 · 3 comments
Closed

can't easily extend sets in option maps #4

kkinnear opened this issue Dec 9, 2016 · 3 comments
Assignees
Labels

Comments

@kkinnear
Copy link
Owner

kkinnear commented Dec 9, 2016

In particular, you can't do this: (set-options! {:fn-force-nl #{:binding}}), and have it add to the existing set that is the value for :fn-force-nl. At present it replaces the set that is there, and it should not. It should operate just like the maps to. This isn't just for set-options!, it is true of any options map -- the command line, lein-zprint, etc.

@kkinnear kkinnear added the bug label Dec 9, 2016
@kkinnear kkinnear self-assigned this Dec 9, 2016
@kkinnear kkinnear changed the title can't easily extends sets in option maps can't easily extend sets in option maps Dec 9, 2016
@mynomoto
Copy link
Contributor

I would recommend you to take a look at https://github.com/weavejester/meta-merge because if you make this additive how would you remove things from the set? meta-merge uses metadata to config this and at least serve as inspiration for a solution.

@kkinnear
Copy link
Owner Author

Thanks for the comment. You make a good point about removing things. I would like to think that I would have thought of that when I went to fix this bug, but there is no guarantee of that. I'll give this some more thought -- particularly since I'm thinking that I may need another set or maybe two to handle some of the different formatting issues that have come up recently.

@kkinnear
Copy link
Owner Author

This is fixed in 0.2.10.

Thanks for the pointer to themeta-merge. It didn't quite fit, but was certainly worth looking at. I ended up adding a configuration option: :remove {:fn-force-nl #{...} :fn-gt2-force-nl #{...} :fn-gt3-force-nl #{...}} which will remove the elements of the sets from the current configuration. The remove is processed before any additions. This seemed to fit best with the normal usage, where people want to remove one thing or add one thing.

I also changed the way you add to sets, so now you don't have to replace the entire set, but anything you put into one of the three sets (:fn-force-nl, :fn-gt2-force-nl, :fn-gt3-force-nl) will be added to the existing set, instead of whatever you give replacing the entire set.

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

No branches or pull requests

2 participants