emacs-devel
[Top][All Lists]
Advanced

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

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


From: Juri Linkov
Subject: Re: ASCII-folded search [was: Re: Upcoming loss of usability ...]
Date: Wed, 24 Jun 2015 01:49:32 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (x86_64-pc-linux-gnu)

>> 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 like "A" matches "a" in case insensitive mode),
but this could be added later.

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 ")



reply via email to

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