You can customize case conversion by installing a special case table. A case table specifies the mapping between upper case and lower case letters. It affects both the string and character case conversion functions (see the previous section) and those that apply to text in the buffer (see section Case Changes). You need a case table if you are using a language which has letters other than the standard ASCII letters.
A case table is a list of this form:
(downcase upcase canonicalize equivalences)
where each element is either nil
or a string of length 256. The
element downcase says how to map each character to its lower-case
equivalent. The element upcase maps each character to its
upper-case equivalent. If lower and upper case characters are in
one-to-one correspondence, use nil
for upcase; then Emacs
deduces the upcase table from downcase.
For some languages, upper and lower case letters are not in one-to-one correspondence. There may be two different lower case letters with the same upper case equivalent. In these cases, you need to specify the maps for both directions.
The element canonicalize maps each character to a canonical equivalent; any two characters that are related by case-conversion have the same canonical equivalent character.
The element equivalences is a map that cyclicly permutes each equivalence class (of characters with the same canonical equivalent). (For ordinary ASCII, this would map `a' into `A' and `A' into `a', and likewise for each set of equivalent characters.)
When you construct a case table, you can provide nil
for
canonicalize; then Emacs fills in this string from upcase
and downcase. You can also provide nil
for
equivalences; then Emacs fills in this string from
canonicalize. In a case table that is actually in use, those
components are non-nil
. Do not try to specify equivalences
without also specifying canonicalize.
Each buffer has a case table. Emacs also has a standard case table which is copied into each buffer when you create the buffer. Changing the standard case table doesn't affect any existing buffers.
Here are the functions for working with case tables:
nil
if object is a valid case
table.
The following three functions are convenient subroutines for packages that define non-ASCII character sets. They modify a string downcase-table provided as an argument; this should be a string to be used as the downcase part of a case table. They also modify the standard syntax table. See section Syntax Tables.
You can load the library `iso-syntax' to set up the standard syntax table and define a case table for the 8-bit ISO Latin 1 character set.
Go to the first, previous, next, last section, table of contents.