www.delorie.com/gnu/docs/elisp-manual-21/elisp_511.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

32.13 Adaptive Fill Mode

Adaptive Fill mode chooses a fill prefix automatically from the text in each paragraph being filled.

User Option: adaptive-fill-mode
Adaptive Fill mode is enabled when this variable is non-nil. It is t by default.

Function: fill-context-prefix from to
This function implements the heart of Adaptive Fill mode; it chooses a fill prefix based on the text between from and to. It does this by looking at the first two lines of the paragraph, based on the variables described below.

User Option: adaptive-fill-regexp
This variable holds a regular expression to control Adaptive Fill mode. Adaptive Fill mode matches this regular expression against the text starting after the left margin whitespace (if any) on a line; the characters it matches are that line's candidate for the fill prefix.

User Option: adaptive-fill-first-line-regexp
In a one-line paragraph, if the candidate fill prefix matches this regular expression, or if it matches comment-start-skip, then it is used--otherwise, spaces amounting to the same width are used instead.

However, the fill prefix is never taken from a one-line paragraph if it would act as a paragraph starter on subsequent lines.

User Option: adaptive-fill-function
You can specify more complex ways of choosing a fill prefix automatically by setting this variable to a function. The function is called when adaptive-fill-regexp does not match, with point after the left margin of a line, and it should return the appropriate fill prefix based on that line. If it returns nil, that means it sees no fill prefix in that line.

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003