2

Suppose I have bár written in a file, I would like to look for bar in swiper and find the occurrences of bár alongside the expected occurrences of bar, how I can do this? This would also apply to characters like e=é=è, o=ö, u=ü, a=å, o=ó=ö, c=ç, etc.

1 Answer 1

3

Having bar match bár is called character folding, and is supported by the built-in functions isearch and query-replace since Emacs 25; see (emacs) Lax Search and (emacs) Search Customizations for details.

swiper automatically performs character folding when search-default-mode is set to the function char-fold-to-regexp, which you can achieve by e.g. adding

(setq search-default-mode #'char-fold-to-regexp)

to your user-init-file. Voila:

char folding

3
  • That worked for swiper, but for some reason it did not work with ivy-bibtex. Jun 19, 2018 at 15:11
  • 1
    @k76u4vkweek547v7 That is because the char-fold-to-regexp integration is specific to the regexp builder for swiper. Feel free to submit a feature request on the project's issue tracker: github.com/abo-abo/swiper/issues.
    – Basil
    Jun 19, 2018 at 15:31
  • 1
    @k76u4vkweek547v7 Adding to that, one solution is to use that re-builder for swiper, i.e. (setq ivy-re-builders-alist '((ivy-bibtex . swiper--re-builder)))
    – leafpile
    Mar 1, 2020 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.