Case sensitive matching
saolaolsson opened this issue · comments
Would it be possible to support case sensitive matching using style dispatchers? As far as I can tell, it's not currently possible, but such a solution would be more flexible than toggling completion-ignore-case
manually.
I am aware of orderless-smart-case
but as all "smart case" solutions it doesn't work when the thing you're interested in is all lower case.
You could do something like this
(defun case-dispatcher (target _index _total)
(when (equal "&&" target)
(setq-local orderless-smart-case nil completion-ignore-case nil)
'(orderless-literal . "")))
(add-to-list 'orderless-style-dispatchers #'case-dispatcher)
Then, whenever you toss in a component that is &&
the matching turns case sensitive (even if you delete the &&
) for the rest of the current minibuffer session.
As a better alternative to your example above one can probably define a custom pattern compiler which either sets or unsets completion-ignore-case depending on the presence of &&, such that it won't affect the session forever?
Yes, one could. But you can also make that same style dispatcher turn off case sensistivity when given a single &
. That way to turn it off again you just delete a &
(or both).
It appears style dispatching is more flexible than I thought. This'll work fine for my needs. Thank you!