mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
Add variable `fill-region-as-paragraph-function'
Add the variable `fill-region-as-paragraph-function' to provide a way to override how functions like `fill-region' fill text. * doc/lispref/text.texi (Filling): Document `fill-region-as-paragraph-function' variable. * doc/emacs/text.texi (Fill Commands): Reference `fill-region-as-paragraph-function' variable. * lisp/textmodes/fill.el (fill-region-as-paragraph-function): Add variable. (fill-region-as-paragraph): Convert into `fill-region-as-paragraph-function' wrapper. (fill-region-as-paragraph-default): Rename old `fill-region-as-paragraph' function. (fill-region-as-paragraph-semlf): Update calls to `fill-region-as-paragraph-default'. (fill-region): Add reference to `fill-region-as-paragraph-function' in doc string. * test/lisp/textmodes/fill-tests.el (fill-test-fill-region): Add test case for the `fill-region' function. * test/lisp/textmodes/fill-resources/fill-region.erts: Add test data. (Bug#78816)
This commit is contained in:
parent
bca0ce9d07
commit
99ec286d78
5 changed files with 104 additions and 18 deletions
|
|
@ -600,12 +600,15 @@ can also call @kbd{M-x fill-region} to specifically fill the text in
|
|||
the region.
|
||||
|
||||
@findex fill-region-as-paragraph
|
||||
@vindex fill-region-as-paragraph-function
|
||||
@kbd{M-q} and @code{fill-region} use the usual Emacs criteria for
|
||||
finding paragraph boundaries (@pxref{Paragraphs}). For more control,
|
||||
you can use @kbd{M-x fill-region-as-paragraph}, which refills
|
||||
everything between point and mark as a single paragraph. This command
|
||||
deletes any blank lines within the region, so separate blocks of text
|
||||
end up combined into one block.
|
||||
you can use @kbd{M-x fill-region-as-paragraph}, which refills everything
|
||||
between point and mark as a single paragraph. The behavior of this
|
||||
command is controlled by the variable
|
||||
@code{fill-region-as-paragraph-function}. By default, it deletes any
|
||||
blank lines within the region, so separate blocks of text end up
|
||||
combined into one block.
|
||||
|
||||
@cindex justification
|
||||
A numeric argument to @kbd{M-q} tells it to @dfn{justify} the text
|
||||
|
|
|
|||
|
|
@ -1737,7 +1737,12 @@ described above.
|
|||
|
||||
@deffn Command fill-region-as-paragraph start end &optional justify nosqueeze squeeze-after
|
||||
This command considers a region of text as a single paragraph and fills
|
||||
it. If the region was made up of many paragraphs, the blank lines
|
||||
it. The behavior of this command is controlled by the variable
|
||||
@code{fill-region-as-paragraph-function}, with the default
|
||||
implementation being @code{fill-region-as-paragraph-default}, which is
|
||||
described in detail below.
|
||||
|
||||
If the region was made up of many paragraphs, the blank lines
|
||||
between paragraphs are removed. This function justifies as well as
|
||||
filling when @var{justify} is non-@code{nil}.
|
||||
|
||||
|
|
@ -1841,6 +1846,14 @@ paragraphs actually moved. The default value of this variable is
|
|||
Manual}.
|
||||
@end defvar
|
||||
|
||||
@defvar fill-region-as-paragraph-function
|
||||
This variable provides a way to override how functions like
|
||||
@code{fill-region} fill text. Its value should be a function, which
|
||||
should accept the arguments defined by @code{fill-region-as-paragraph}
|
||||
and return the fill prefix used for filling. The default value of this
|
||||
variable is @code{fill-region-as-paragraph-default}.
|
||||
@end defvar
|
||||
|
||||
@defvar use-hard-newlines
|
||||
If this variable is non-@code{nil}, the filling functions do not delete
|
||||
newlines that have the @code{hard} text property. These hard
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue