Next: , Up: Moving by Word and Paragraph   [Index]


6.5.3.1 What Constitutes a Word

Mode writers make assumptions about the nature of the text in a buffer. Different modes require different assumptions about text. Every character is given a meaning by the mode author, directly or indirectly, in a registry that maps the characters to a particular syntactic meaning. This registry is called a syntax table.

Syntax Table

Every character — printable characters, including Unicode code points — are given a meaning by the mode author, directly or indirectly, in a registry that maps the characters to a particular syntactic meaning. The syntax table keeps track of things like, "What characters are used for comments?" or "What characters make up a word?" and, although obscured from view, affects every part of Emacs.

The syntax table alone decides the makeup of a word (or symbol, punctuation, comment, etc.) as a syntactic unit. So when you move the point around on the screen, it moves according to the syntax table and the general rules governing forward-word and backward-word.

What sets Emacs apart from other editors is that you can inspect and change the syntax table, which in turn will affect how your point moves across the screen when you invoke certain commands.

You can view your current buffer’s syntax table by typing ‘C-h s’. In it you will see a human readable version of the characters and their assigned syntax class.

Function: describe-syntax &optional buffer (C-h s)

Describe the syntax specifications in the syntax table of ‘BUFFER’. The descriptions are inserted in a help buffer, which is then displayed.

BUFFER

defaults to the current buffer.

Emacs will generally ignore non-word characters immediately following the point in the direction you are travelling.


Next: Sub- and Superword Movement—Glasses Mode, Up: Moving by Word and Paragraph   [Index]