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

Allow user to enable rainbow-identifiers-mode without making it default #6192

Closed
wants to merge 2 commits into from
Closed

Conversation

curtmack
Copy link
Contributor

@curtmack curtmack commented Jun 1, 2016

When you add the colors layer with the rainbow-identifiers package enabled (colors-enable-rainbow-identifiers variable set to t), currently the layer always adds 'rainbow-identifiers-mode to the prog-mode-hook, essentially making it the default. This PR adds a new variable, colors-rainbow-identifiers-add-hook, which controls this behavior. Defaults to t (previous behavior); if set to nil, this hook is not created. This allows a user to install rainbow-identifiers through the preexisting layer, still getting the SPC t C i toggle binding, without turning it on by default.

Example usage has also been added to the README.org for the colors layer.

I've been running with this for a few months now, but just now got around to prettying it up for release; let me know if there's any style/naming issues.

When you add the colors layer with rainbow-identifiers enabled,
currently Spacemacs always adds rainbow-identifiers-mode to the
prog-mode-hook, essentially making it the default. This adds a new variable,
colors-rainbow-identifiers-add-hook, which controls this behavior.
Defaults to t; if set to nil, this hook is not created.

Example usage has also been added to the README.org for the colors
layer.
@TheBB
Copy link
Collaborator

TheBB commented Jun 2, 2016

Can't people who want this just use (remove-hook 'prog-mode-hook 'rainbow-identifiers-mode)?

@curtmack
Copy link
Contributor Author

curtmack commented Jun 3, 2016

That's also a perfectly fine solution; I made this change originally because creating the hook automatically seemed somewhat rude, but that's admittedly a very "feely" justification.

If no one else has any better reason for wanting this feature, I'll happily close the pull request.

@syl20bnr
Copy link
Owner

syl20bnr commented Jun 3, 2016

I see your point, we have this kind of control on flycheck and some other layers.
I think we don't need a new variable to achieve what you want.

What I would do is to remove this line https://github.com/syl20bnr/spacemacs/blob/develop/layers/+themes/colors/packages.el#L46
And use the layer variable colors-enable-rainbow-identifiers to guard the hook: https://github.com/syl20bnr/spacemacs/blob/develop/layers/+themes/colors/packages.el#L65
We can also rename this variable colors-enable-rainbow-identifiers-by-default and add an alias on the old name for backward compatibility.

Can you update your PR with the above modifications ?

Per syl20bnr's comment on PR 6192, the package should always be
installed with the colors layer, but only hooked into prog-mode when the
variable is active. Renamed the variable
colors-enable-rainbow-identifiers-by-default to clarify this, and
modified the documentation.
@curtmack
Copy link
Contributor Author

curtmack commented Jun 3, 2016

Okay, that's done.

@syl20bnr syl20bnr added the Merged label Jun 4, 2016
@syl20bnr
Copy link
Owner

syl20bnr commented Jun 4, 2016

Thank you ! 👍
Cherry-picked into develop branch, you can safely delete your branch.

In the end I removed this variable for a new variable color-colorize-identifiers, in your case you should set it to nil. More info in this comment: #2930 (comment)

@syl20bnr syl20bnr closed this Jun 4, 2016
@syl20bnr syl20bnr removed the Merged label Jun 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants