emacs-devel
[Top][All Lists]
Advanced

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

Re: Case mapping of sharp s


From: Ulrich Mueller
Subject: Re: Case mapping of sharp s
Date: Mon, 30 Nov 2009 08:01:32 +0100

>>>>> On Mon, 30 Nov 2009, Juri Linkov wrote:

> BTW, does anyone know how to put a set of characters into one
> category for the purpose of searching, without affecting case
> mapping? I.e. to not change the current case mappings, but allow a
> character from one category to match all other characters from the
> same category.

> `set-case-syntax-pair' is not suitable because it does this only for
> a pair of characters and also changes case mappings.

> Of course, it's possible to search with a regexp that matches a
> character set in [...], or more convenient when a space in a regexp
> is substituted with a set of characters from `search-spaces-regexp'.

> I can't find a function like `set-case-syntax-pair' that would
> define a set of equivalent characters for the search, so maybe this
> is not possible.

I'm not sure if it's exactly what you need, but I use the following to
search for characters while ignoring any accents:

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

I don't know if there is a simpler way to achieve this.

See also the following thread, from 1994 :-)
<http://groups.google.de/group/gnu.emacs.bug/browse_thread/thread/f337b3650fbee9fe/abd8d16ab34c264e>

Ulrich




reply via email to

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