[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Upcoming loss of usability of Emacs source files and Emacs.
From: |
Ulrich Mueller |
Subject: |
Re: Upcoming loss of usability of Emacs source files and Emacs. |
Date: |
Thu, 18 Jun 2015 07:27:37 +0200 |
>>>>> On Wed, 17 Jun 2015, Marcin Borkowski wrote:
> On the other hand, it would be great if we had an "ascii-folding"
> option, making (some reasonable subset of) Unicode "equivalent" to
> ASCII, so that we could easily search for e.g. the Polish word ‘żółw’
> (meaning "turtle") by typing `zolw'. (I have to say that lack of this
> is one of my main gripes with A****n's K****e e-book reader - this
> renders the "search" option unusable for non-English texts...)
I have the following code in my .emacs which does exactly that:
;; Ignore accent and umlaut marks when searching.
;; Works for Emacs 19.30 and later.
(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))
Maybe it could be used as the basis for a minor mode? Downside is that
the above will significantly slow down search in multibyte buffers.
This is because equivalent characters have a different number of bytes
in UTF-8, therefore the Boyer-Moore algorithm cannot be used any more.
Ulrich
- RE: ASCII-folded search [was: Re: Upcoming loss of usability ...], (continued)
- RE: ASCII-folded search [was: Re: Upcoming loss of usability ...], Drew Adams, 2015/06/27
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Artur Malabarba, 2015/06/26
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Juri Linkov, 2015/06/27
- RE: ASCII-folded search [was: Re: Upcoming loss of usability ...], Drew Adams, 2015/06/26
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Eli Zaretskii, 2015/06/23
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Artur Malabarba, 2015/06/23
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Eli Zaretskii, 2015/06/23
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Eli Zaretskii, 2015/06/23
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Artur Malabarba, 2015/06/23
- Re: ASCII-folded search [was: Re: Upcoming loss of usability ...], Eli Zaretskii, 2015/06/23
- Re: Upcoming loss of usability of Emacs source files and Emacs.,
Ulrich Mueller <=
- Re: Upcoming loss of usability of Emacs source files and Emacs., Eli Zaretskii, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Ulrich Mueller, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Eli Zaretskii, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Ulrich Mueller, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Steinar Bang, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Eli Zaretskii, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Steinar Bang, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Marcin Borkowski, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Steinar Bang, 2015/06/18
- Re: Upcoming loss of usability of Emacs source files and Emacs., Steinar Bang, 2015/06/18