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

"Smart" case fold? #22

Closed
AmaiKinono opened this issue Mar 1, 2020 · 8 comments
Closed

"Smart" case fold? #22

AmaiKinono opened this issue Mar 1, 2020 · 8 comments

Comments

@AmaiKinono
Copy link
Contributor

In isearch, the default behavior is do case insensitive search when the user input is all lower case, and do case sensitive search otherwise. This is neat.

I once thought this behavior is controled by case-fold-search, but then I found it controls case sensitivity directly. If there's no built-in mechanism for this, we may need to invent our own.

@raxod502
Copy link
Member

raxod502 commented Mar 1, 2020

That seems fine as an optional configuration. We can just use isearch-no-upper-case-p; it's not going anywhere.

@raxod502
Copy link
Member

Case folding is now guessed based on the current search query by default, and you can toggle it persistently (for the search session) using M-s c, the same binding as in Isearch.

@AmaiKinono
Copy link
Contributor Author

This works well! But I don't know if the keybinding is the best. M-s calls next-matching-history-item in minibuffer by default, so I have to bind ctrlf-toggle-case-fold-search to another key to use it.

@raxod502
Copy link
Member

I noticed that. Any suggestions on a better binding? I was unable to find anything standard that wasn't a bad idea in one way or another.

@AmaiKinono
Copy link
Contributor Author

How about M-c? That seems to do the same thing in isearch.

@raxod502
Copy link
Member

But as I mention in #29, that conflicts with capitalize-dwim, which to me is even worse than conflicting with next-matching-history-item as it is a better-known command.

@AmaiKinono
Copy link
Contributor Author

Ah yes... I think bind M-s to nil is not a bad idea. Or if we have to invent it, I think we could have a prefix key (like C-o in ivy. I personally have M-l (means "local") in various temporary state / special major mode to execute their commands), and put c under it to toggle case fold. In the future we may have other switches, and commands like "recursive edit" during replacing, we could put those under that prefix too. Actually I think it's a good idea to also have search style switches under it.

@raxod502
Copy link
Member

M-l is bad because it conflicts with downcase-dwim, but C-o is a fair choice because wanting to use open-line in the middle of a search would be an odd use case. Changed.

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

No branches or pull requests

2 participants