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: Stefan Monnier
Subject: Re: Case mapping of sharp s
Date: Sun, 29 Nov 2009 20:22:39 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> 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.

In theory, there is some amount of support for it via the slot nb 2 of
case tables:

   (defun get-eqvcase-table (case-table)
     "Return the eqvcase table of CASE-TABLE."
     (get-case-table-extra-slot case-table 2))

but AFAIK it's not used by search primitives, which instead implement
case-fold by something like (eq (lower CHAR1) (lower CHAR2)) which is
often cheaper than checking (memq CHAR1 <eqvcase>).

I bumped into it while working on a "lex in Elisp", where using such an
equiv-table makes a lot more sense (it makes the DFA larger, but speeds
up the matching by removing a call to `lower' from the inner loop).


        Stefan




reply via email to

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