Variable: word-wrap

word-wrap is a customizable and buffer-local variable defined in buffer.c.

Documentation

Non-nil means to use word-wrapping for continuation lines.

When word-wrapping is on, continuation lines are wrapped at the space or tab character nearest to the right window edge. If nil, continuation lines are wrapped at the right screen edge.

This variable has no effect if long lines are truncated (see truncate-lines and truncate-partial-width-windows). If you use word-wrapping, you might want to reduce the value of truncate-partial-width-windows, since wrapping can make text readable in narrower windows.

Instead of setting this variable directly, most users should use Visual Line mode. Visual Line mode, when enabled, sets word-wrap to t, and additionally redefines simple editing commands to act on visual lines rather than logical lines. See the documentation of visual-line-mode(var)/visual-line-mode(fun).

Probably introduced at or before Emacs version 23.1.

Source Code

// Defined in /usr/src/emacs/src/buffer.c
  DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil,
		     doc: /* Non-nil means to use word-wrapping for continuation lines.
When word-wrapping is on, continuation lines are wrapped at the space
or tab character nearest to the right window edge.
If nil, continuation lines are wrapped at the right screen edge.

This variable has no effect if long lines are truncated (see
`truncate-lines' and `truncate-partial-width-windows').  If you use
word-wrapping, you might want to reduce the value of
`truncate-partial-width-windows', since wrapping can make text readable
in narrower windows.

Instead of setting this variable directly, most users should use
Visual Line mode.  Visual Line mode, when enabled, sets `word-wrap'
to t, and additionally redefines simple editing commands to act on
visual lines rather than logical lines.  See the documentation of
`visual-line-mode'.  */);