Go to the first, previous, next, last section, table of contents.

The Case Table

You can customize case conversion using the new case table feature. A case table is a collection of strings that specifies the mapping between upper case and lower case letters. Each buffer has its own case table. You need a case table if you are using a language which has letters that are not 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 1-1 correspondence, use nil for upcase; then Emacs deduces the upcase table from downcase.

For some languages, upper and lower case letters are not in 1-1 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).

You can provide nil for both canonicalize and equivalences, in which case both are deduced from downcase and upcase.

Here are the functions for working with case tables:

case-table-p is a predicate that says whether a Lisp object is a valid case table.

set-standard-case-table takes one argument and makes that argument the case table for new buffers created subsequently. standard-case-table returns the current value of the new buffer case table.

current-case-table returns the case table of the current buffer. set-case-table sets the current buffer's case table to the argument.

set-case-syntax-pair is a convenient function for specifying a pair of letters, upper case and lower case. Call it with two arguments, the upper case letter and the lower case letter. It modifies the standard case table and a few syntax tables that are predefined in Emacs. This function is intended as a subroutine for packages that define non-ASCII character sets.

Load the library `iso-syntax' to set up the syntax and case table for the 256 bit ISO Latin 1 character set.


Go to the first, previous, next, last section, table of contents.