You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to make a new "matching style" (not sure if I'm using the correct jargon) to make filtering in orderless behaves well with diacritics. For example typing resume would match résumé, etc...
I have written a small function that would convert résumé to resume, using the built-in ucs-normalize.el:
(defunremove-diacritics (s)
(replace-regexp-in-string
ucs-normalize-nfd-quick-check-regexp ""
(ucs-normalize-NFD-string s)))
However, adding this function to either orderless-matching-styles or orderless-style-dispatchers doesn't seem to work. I read the README but haven't been able to wrap my head around this. Any help is appreciated. Thanks!
The text was updated successfully, but these errors were encountered:
You may be thinking backwards about how to do this. A matching style gets called on the pattern you type to turn it into a regexp. So here's what happens with the remove-diacritics matching style: say you have "résumé" among the candidates and you type "resume" at the prompt, then remove-diacritics gets called with the pattern you typed, namely "resume", and turns it into the regexp "resume" which, of course, does not match "résumé".
What you need instead of remove-diacritics is a function that turns "resume" into some regexp that does match "résumé". The built-in function char-fold-to-regexp fits the bill, so you can delete your remove-diacritics and add char-fold-to-regexp directly to orderless-matching-styles.
I am trying to make a new "matching style" (not sure if I'm using the correct jargon) to make filtering in
orderless
behaves well with diacritics. For example typingresume
would matchrésumé
, etc...I have written a small function that would convert
résumé
toresume
, using the built-inucs-normalize.el
:However, adding this function to either
orderless-matching-styles
ororderless-style-dispatchers
doesn't seem to work. I read the README but haven't been able to wrap my head around this. Any help is appreciated. Thanks!The text was updated successfully, but these errors were encountered: