New in Emacs 25.1: Easily search for non-ASCII characters02 Feb 2016, by Artur Malabarba.
New in 25.1 post series
- New in Emacs 25.1: Query-replace history is enhanced.
- New in Emacs 25.1: Better Rectangles
- New on Elpa and in Emacs 25.1: let-alist
- New in Emacs 25.1: Easily install multifile package from a directory
- New in Emacs 25.1: comment-line
- New on Elpa and in Emacs 25.1: seq.el
- New in Emacs 25.1: Have prettify-symbols-mode reveal the symbol at point
- New in Emacs 25.1: Round quotes in Help buffers
- New in Emacs 25.1: Easily search for non-ASCII characters
- New in Emacs 25.1: EWW improvements
- New in Emacs 25.1: map.el library
- New in Emacs 25.1: More flow control macros
Since last week’s post was about Unicode characters, it makes sense to continue that trend today. This feature might go unnoticed by a lot of people who live in an ASCII world, but it will probably jump out at everyone else at one point or another. The name, if a bit odd, is “character-folding search”.
In Emacs 25, Isearch can find a wide range of Unicode characters (like á, ⓐ, or
𝒶) when you search for ASCII characters (
a in this example). To enable this
feature, set the variable
This first came up due to a new feature of a recent version of Texinfo, where some markup styles are exported in “round quotes” when generating the info manual. This is a nice improvement in readability, but when you’re trying to search for something with C-s, things can get a little difficult if your keyboard can’t type some of the characters.
With char-folding, when you hit C-s and search for ", Emacs will also search for a variety of double quotes, from the aforementioned “” to many others like «» and ❝❞. The same goes for the single quote, and for pretty much any other ASCII character.
You could always type any Unicode character by name with C-x 8 RET, and many of them even have their own shortcuts under C-x 8, but not having to type them can be a significant convenience when it comes up. As any Brazilian, I am a daily user of diacritical marks (ó, ã, ê, and the likes), and even though my keyboard can type these characters, I still enjoy the simplicity of not having to.
Finally, you can extend this feature to the
query-replace command, which is
also as easy as setting a variable.