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

ivy.el (ivy-case-fold-search): Add additional value 'always #916

Closed

Conversation

@fabacino
Copy link
Contributor

@fabacino fabacino commented Mar 13, 2017

If the value of ivy-case-fold-search is set to 'always, the search is always case-insensive, regardless of the input. Previously it was not possible to do a case-insensitive search when the input was not all lower case.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Mar 13, 2017

I'd like to avoid ivy-toggle-case-fold being a three way toggle. It should either toggle nil/auto or nil/always, depending on ivy-case-fold-search-default.

Also, since the change is over 15 lines, you'll need an Emacs Copyright Assignment. See the README for more info.

@fabacino
Copy link
Contributor Author

@fabacino fabacino commented Mar 13, 2017

Thanks for your input.

I think auto should stay the default value, as it works perfectly for almost all use cases and is also consistent with isearch-forward and friends. Both nil and always basically do the same thing, which is to overrule the default behaviour regarding case-sensitivity, and thus are only necessary in rather special cases. A toggle between nil and always, being both special cases, does not seem very useful to me.

I added the variable ivy-case-fold-search-default instead of hard-coding auto into ivy--reset-state in order for a wrapping function to be able to tell ivy how the search should be performed (by default). This is useful if you have an option in your counsel-package regarding case-sensitivity and want to relay that information to ivy.
But I probably should make ivy-case-fold-search-default a defvar instead of a defcustom, because this is not something the user is likely to ever change explicitly.

Does this make more sense to you now or do you still prefer a different solution than a three-way toogle?

I'll take care of the Emacs Copyright Assignment.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Mar 13, 2017

Say the input is test and the setting is auto. This means it's case-folded. A 1-way toggle to nil is useful to match test and not Test. Say the setting is nil. Toggling to auto is useful again. Assuming the user only inputs lower case, always is the same as auto. So only an auto <-> nil toggle is needed.

Now assume the setting is always. The only other useful state is nil. Again, only a 2-way toggle is needed: always <-> nil.

So I suggest to take user's setting of ivy-case-fold-search-default and toggle between that and nil.

Also note that the minibuffer is a regular edit field, you can use a key binding that toggles the case of e.g. symbol-at-point.

fabacino added 2 commits Mar 14, 2017
If the value of ivy-case-fold-search is set to 'always, the search is
always case-insensive, regardless of the input.
@fabacino
Copy link
Contributor Author

@fabacino fabacino commented Mar 14, 2017

I think I understand your point of view now, thanks for the explanation.
I will update the branch accordingly.

@fabacino fabacino force-pushed the feature/enhance-case-fold-search branch from 28dd647 to a6f629a Mar 14, 2017
@fabacino
Copy link
Contributor Author

@fabacino fabacino commented Mar 15, 2017

The Copyright Assignment is complete now.

@abo-abo abo-abo closed this in 13def15 Mar 16, 2017
@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Mar 16, 2017

Merged, thanks. How did you get the CA so fast?

@fabacino
Copy link
Contributor Author

@fabacino fabacino commented Mar 16, 2017

You can send them a scanned copy of the signed document instead of a postal letter, which speeds up the process tremendously. They also respond to mails pretty fast, I got the confirmation mail within 48h after I sent the initial request.

@abo-abo
Copy link
Owner

@abo-abo abo-abo commented Mar 16, 2017

Great. You can now use the CA to contribute to any part of Emacs: ELPA packages, Org-mode or the core.

@fabacino fabacino deleted the feature/enhance-case-fold-search branch Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants