@node Word Motion
@subsection Motion by Words
- These functions for parsing words use the syntax table to decide
-whether a given character is part of a word. @xref{Syntax Tables}.
+ The functions for parsing words described below use the syntax table
+to decide whether a given character is part of a word. @xref{Syntax
+Tables}.
@deffn Command forward-word &optional count
This function moves point forward @var{count} words (or backward if
@var{count} is negative). If @var{count} is omitted or @code{nil}, it
-defaults to 1.
+defaults to 1. In an interactive call, @var{count} is specified by
+the numeric prefix argument.
``Moving one word'' means moving until point crosses a
-word-constituent character and then encounters a word-separator
-character. However, this function cannot move point past the boundary
-of the accessible portion of the buffer, or across a field boundary
+word-constituent character, which indicates the beginning of a word,
+and then continue moving until the word ends. By default, characters
+that begin and end words, known as @dfn{word boundaries}, are defined
+by the current buffer's syntax table (@pxref{Syntax Class Table}), but
+modes can override that by setting up a suitable
+@code{find-word-boundary-function-table}, described below. In any
+case, this function cannot move point past the boundary of the
+accessible portion of the buffer, or across a field boundary
(@pxref{Fields}). The most common case of a field boundary is the end
of the prompt in the minibuffer.
If @code{inhibit-field-text-motion} is non-@code{nil},
this function ignores field boundaries.
-In an interactive call, @var{count} is specified by the numeric prefix
-argument.
@end deffn
@deffn Command backward-word &optional count
@defopt words-include-escapes
@c Emacs 19 feature
-This variable affects the behavior of @code{forward-word} and everything
-that uses it. If it is non-@code{nil}, then characters in the
-escape and character-quote syntax classes count as part of
-words. Otherwise, they do not.
+This variable affects the behavior of @code{forward-word} and
+@code{backward-word}, and everything that uses them. If it is
+non-@code{nil}, then characters in the escape and character-quote
+syntax classes count as part of words. Otherwise, they do not.
@end defopt
@defvar inhibit-field-text-motion
@code{forward-paragraph} ignore field boundaries.
@end defvar
+@defvar find-word-boundary-function-table
+This variable affects the behavior of @code{forward-word} and
+@code{backward-word}, and everything that uses them. Its value is a
+char-table (@pxref{Char-Tables}) of functions to search for word
+boundaries. If a character has a non-@code{nil} entry in this table,
+then when a word starts or ends with that character, the corresponding
+function will be called with 2 arguments: @var{pos} and @var{limit}.
+The function should return the position of the other word boundary.
+Specifically, if @var{pos} is smaller than @var{limit}, then @var{pos}
+is at the beginning of a word, and the function should return the
+position after the last character of the word; otherwise, @var{pos} is
+at the last character of a word, and the function should return the
+position of that word's first character.
+@end defvar
+
+@defun forward-word-strictly &optional count
+This function is like @code{forward-word}, but it is not affected by
+@code{find-word-boundary-function-table}. Lisp programs that should
+not change behavior when word movement is modified by modes which set
+that table, such as @code{subword-mode}, should use this function
+instead of @code{forward-word}.
+@end defun
+
+@defun backward-word-strictly &optional count
+This function is like @code{backward-word}, but it is not affected by
+@code{find-word-boundary-function-table}. Like with
+@code{forward-word-strictly}, use this function instead of
+@code{backward-word} when movement by words should only consider
+syntax tables.
+@end defun
+
@node Buffer End Motion
@subsection Motion to an End of the Buffer
@cindex move to beginning or end of buffer