[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ASCII-folded search [was: Re: Upcoming loss of usability ...]

From: Artur Malabarba
Subject: Re: ASCII-folded search [was: Re: Upcoming loss of usability ...]
Date: Wed, 24 Jun 2015 09:03:48 +0100

2015-06-23 23:49 GMT+01:00 Juri Linkov >>> Have you found a way to
combine char-folding with case-folding?
>> Yes. This particular patch uses regexps, so it works independently of
>> case-fold-search. That is, if case-fold-search is on, then you will get
>> case folding in addition to this.
>>> (in https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00407.html
>>> another hard problem was char-folding with a combining character.)
>> That works too. "a" matches both "á" (the letter) and "á" (a letter with a
>> combining character).

> It would be easy also to allow "á" match "a" (by normalizing the
> original search string

It's easy for things like “ⓐ” or “á”, which are single characters,
normalizing a combination of multiple characters (like “á”) can get a
little complicated. But then, I don't think we want to do either.

> like "A" matches "a" in case insensitive mode),

It doesn't for me. If I type C-s A, it only matches the capital “A”.
Whereas if I type C-s a it matches both “a” and “A”. The same happens
during query-replace and other commands. That's a feature, not a flaw.
If the user explicitly typed out “á”, they probably don't want to
match “a” (or they would have just typed “a” in the first place).

> Regarding the usage of the regexp, please consider a simpler way
> to use your character-folding regexp that would be just:
> (define-key isearch-mode-map "\M-sd" 'isearch-toggle-character-fold)
> (defun isearch-toggle-character-fold ()
>   (interactive)
>   (setq isearch-word (unless (eq isearch-word 
> 'isearch--character-folded-regexp)
>                        'isearch--character-folded-regexp))
>   (if isearch-word (setq isearch-regexp nil))
>   (setq isearch-success t isearch-adjusted t)
>   (isearch-update))
> (put 'isearch--character-folded-regexp 'isearch-message-prefix "char-fold ")

Thanks, I was meaning to look into how to make it toggleable. Will
that snippet make it ON by default? If not, how could I do that?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]