Next: Abbrevs Prev: Searching and Matching Up: Top
A "syntax table" provides Emacs with the information that determines
the syntactic use of each character in a buffer. This information is
used by the parsing commands, the complex movement commands, and others
to determine where words, symbols, and other syntactic constructs begin
and end. The current syntax table controls the meaning of the word
motion functions (Note: Word Motion.) and the list motion functions
(Note: List Motion.) as well as the functions in this chapter.
A syntax table is a vector of 256 elements; it contains one entry for
each of the 256 ASCII characters of an 8-bit byte. Each element is an
integer that encodes the syntax of the character in question.
Syntax tables are used only for moving across text, not for the GNU
Emacs Lisp reader. GNU Emacs Lisp uses built-in syntactic rules when
reading Lisp expressions, and these rules cannot be changed.
Each buffer has its own major mode, and each major mode has its own
idea of the syntactic class of various characters. For example, in Lisp
mode, the character `;' begins a comment, but in C mode, it terminates
a statement. To support these variations, Emacs makes the choice of
syntax table local to each buffer. Typically, each major mode has its
own syntax table and installs that table in each buffer which uses that
mode. Changing this table alters the syntax in all those buffers as
well as in any buffers subsequently put in that mode. Occasionally
several similar modes share one syntax table. Note: Example Major
Modes, for an example of how to set up a syntax table.
- Function: syntax-table-p OBJECT
This function returns `t' if OBJECT is a vector of length 256
elements. This means that the vector may be a syntax table.
However, according to this test, any vector of length 256 is
considered to be a syntax table, no matter what its contents.
- Syntax Descriptors
- How characters are classified.
- Syntax Table Functions
- How to create, examine and alter syntax tables.
- Motion and Syntax
- Moving over characters with certain syntaxes.
- Parsing Expressions
- Parsing balanced expressions
using the syntax table.
- Standard Syntax Tables
- Syntax tables used by various major modes.
- Syntax Table Internals
- How syntax table information is stored.
automatically generated by info2www