6

Does emacs have an incremental search mode, where searching for a character will search for itself and for any other versions of the character with accent marks, similar to how Google Chrome (at least v27) will do when searching in a page?

Alternatively, is there an additional library or piece of elisp code that can put incremental search in such a mode?

For example, incremental search for:

  • 'manana', would find 'manana' or 'mañana'
  • 'motley crue', would also find 'Mötley Crüe' (with case-sensitivity off).

Even a solution that only covers a subset of these characters would be helpful.

user38983
  • 477

2 Answers2

5

Great question. Juri Linkov was talking about implementing this for Emacs, but nothing has come of it so far. See these two Emacs bug threads:

See this part of the first bug thread, for instance. It includes this code from Ulrich Mueller:

   (let ((eqv-list '("aAàÀáÁâÂãÃäÄåÅ"
             "cCçÇ"
             "eEèÈéÉêÊëË"
             "iIìÌíÍîÎïÏ"
             "nNñÑ"
             "oOòÒóÓôÔõÕöÖøØ"
             "uUùÙúÚûÛüÜ"
             "yYýÝÿ"))
     (table (standard-case-table))
     canon)
     (setq canon (copy-sequence table))
     (mapcar (lambda (s)
           (mapcar (lambda (c) (aset canon c (aref s 0))) s))
         eqv-list)
     (set-char-table-extra-slot table 1 canon)
     (set-char-table-extra-slot table 2 nil)
     (set-standard-case-table table))

UPDATE

Character folding (ability to abstract from accents and such, when searching) will be available in Emacs 25. See the NEWS (C-h N) in an Emacs 25 development build. This is a welcome addition, and it promises to be enhanced in future releases.

My library character-fold+.el is one possible enhancement available now. It lets you optionally search not only for accented chars (e.g., é) by typing the base char (e.g., e) but also to do the reverse -- type any of a set of equivalent chars to search for any of them. And it lets you customize character folding by adding your own equivalence classes (and editing those defined by Emacs, other than those for diacritics).

Here is a message to emacs-devel@gnu.org about this.

Drew
  • 2,144
1

I've no perfect solution, but I use incremental regexp search : C-S-s ma[nñ]ana or C-S-s ma.ana but this is not ideal.

Rémi
  • 1,506