GNU Emacs Lisp Reference Manual
Filling means adjusting the lengths of lines (by moving the line breaks) so that they are nearly (but no greater than) a specified maximum width. Additionally, lines can be justified, which means inserting spaces to make the left and/or right margins line up precisely. The width is controlled by the variable fill-column. For ease of reading, lines should be no longer than 70 or so columns.
You can use Auto Fill mode (see Auto Filling) to fill text automatically as you insert it, but changes to existing text may leave it improperly filled. Then you must fill the text explicitly.
Most of the commands in this section return values that are not meaningful. All the functions that do filling take note of the current left margin, current right margin, and current justification style (see Margins). If the current justification style is none, the filling functions don't actually do anything.
Several of the filling functions have an argument justify. If it is non-nil, that requests some kind of justification. It can be left, right, full, or center, to request a specific style of justification. If it is t, that means to use the current justification style for this part of the text (see current-justification, below).
When you call the filling functions interactively, using a prefix argument implies the value full for justify.
nil, each line is justified as well. It uses the ordinary paragraph motion commands to find paragraph boundaries. See Paragraphs.nil. The variable paragraph-separate controls how to distinguish paragraphs. See Standard Regexps.
The first two arguments, start and end, are the beginning and end of the region to be filled. The third and fourth arguments, justify and mail-flag, are optional. If justify is non-nil, the paragraphs are justified as well as filled. If mail-flag is non-nil, it means the function is operating on a mail message and therefore should not fill the header lines.
Ordinarily, fill-individual-paragraphs regards each change in indentation as starting a new paragraph. If fill-individual-varying-indent is non-nil, then only separator lines separate paragraphs. That mode can handle indented paragraphs with additional indentation on the first line.
fill-individual-paragraphs as described above.nil. In an interactive call, any prefix argument requests justification.
In Adaptive Fill mode, which is enabled by default, fill-region-as-paragraph on an indented paragraph when there is no fill prefix uses the indentation of the second line of the paragraph as the fill prefix.
fill-column. It returns nil. The argument how, if non-nil specifies explicitly the style of justification. It can be left, right, full, center, or none. If it is t, that means to do follow specified justification style (see current-justification, below). nil means to do full justification.
If eop is non-nil, that means do left-justification when current-justification specifies full justification. This is used for the last line of a paragraph; even if the paragraph as a whole is fully justified, the last line should not be.
If nosqueeze is non-nil, that means do not change interior whitespace.
left, right, full, center, or none. The default value is left.nil, fill-paragraph calls this function to do the work. If the function returns a non-nil value, fill-paragraph assumes the job is done, and immediately returns that value. The usual use of this feature is to fill comments in programming language modes. If the function needs to fill a paragraph in the usual way, it can do so as follows:
(let ((fill-paragraph-function nil)) (fill-paragraph arg))
nil, the filling functions do not delete newlines that have the hard text property. These ``hard newlines'' act as paragraph separators.