4 Paragraphs

Emacs has several commands that operate on paragraphs, most notably M-q. nXML mode redefines these to work in a way that is useful for XML. The exact rules that are used to find the beginning and end of a paragraph are complicated; they are designed mainly to ensure that M-q does the right thing.

A paragraph consists of one or more complete, consecutive lines. A group of lines is not considered a paragraph unless it contains some non-whitespace characters between tags or inside comments. A blank line separates paragraphs. A single tag on a line by itself also separates paragraphs. More precisely, if one tag together with any leading and trailing whitespace completely occupy one or more lines, then those lines will not be included in any paragraph.

A start-tag at the beginning of the line (possibly indented) may be treated as starting a paragraph. Similarly, an end-tag at the end of the line may be treated as ending a paragraph. The following rules are used to determine whether such a tag is in fact treated as a paragraph boundary: