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.


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

| improve this answer | |
  • That worked for swiper, but for some reason it did not work with ivy-bibtex. – k76u4vkweek547v7 Jun 19 '18 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 '18 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 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.