diff options
| author | Eli Zaretskii | 2021-04-20 15:12:10 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2021-04-20 15:12:10 +0300 |
| commit | cad8913c89fa2c15d6d6ac4fe0c63b6731981472 (patch) | |
| tree | 4688a8abd50fdb0b844633caa08957d21b5afeec | |
| parent | 2b7eed23eb3aff338b737cce91d22bb464259a1a (diff) | |
| download | emacs-cad8913c89fa2c15d6d6ac4fe0c63b6731981472.tar.gz emacs-cad8913c89fa2c15d6d6ac4fe0c63b6731981472.zip | |
Improve filling-related documentation
* doc/emacs/text.texi (Auto Fill, Fill Commands): Mention special
line-breaking rules for CJK characters and the kinsoku rules.
(Bug#47856)
* lisp/textmodes/fill.el
(fill-separate-heterogeneous-words-with-space): Doc fix.
| -rw-r--r-- | doc/emacs/text.texi | 38 | ||||
| -rw-r--r-- | lisp/textmodes/fill.el | 10 |
2 files changed, 33 insertions, 15 deletions
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 208f8a19a9a..2f924b4f7f5 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi | |||
| @@ -502,8 +502,8 @@ text. | |||
| 502 | @cindex mode, Auto Fill | 502 | @cindex mode, Auto Fill |
| 503 | 503 | ||
| 504 | @dfn{Auto Fill} mode is a buffer-local minor mode (@pxref{Minor | 504 | @dfn{Auto Fill} mode is a buffer-local minor mode (@pxref{Minor |
| 505 | Modes}) in which lines are broken automatically at spaces when the | 505 | Modes}) in which lines are broken automatically when the line becomes |
| 506 | line becomes too wide. | 506 | too wide and you type @kbd{@key{SPC}} or @kbd{@key{RET}}. |
| 507 | 507 | ||
| 508 | @table @kbd | 508 | @table @kbd |
| 509 | @item M-x auto-fill-mode | 509 | @item M-x auto-fill-mode |
| @@ -522,12 +522,21 @@ certain major modes, add @code{auto-fill-mode} to the mode hooks | |||
| 522 | (@pxref{Major Modes}). When Auto Fill mode is enabled, the mode | 522 | (@pxref{Major Modes}). When Auto Fill mode is enabled, the mode |
| 523 | indicator @samp{Fill} appears in the mode line (@pxref{Mode Line}). | 523 | indicator @samp{Fill} appears in the mode line (@pxref{Mode Line}). |
| 524 | 524 | ||
| 525 | Auto Fill mode breaks lines automatically at spaces whenever they | 525 | Auto Fill mode breaks lines automatically at the appropriate places |
| 526 | get longer than the desired width. This line breaking occurs only | 526 | whenever lines get longer than the desired width. This line breaking |
| 527 | when you type @key{SPC} or @key{RET}. If you wish to insert a space | 527 | occurs only when you type @kbd{@key{SPC}} or @kbd{@key{RET}}. If you |
| 528 | or newline without permitting line-breaking, type @kbd{C-q @key{SPC}} | 528 | wish to insert a space or newline without permitting line-breaking, |
| 529 | or @kbd{C-q C-j} respectively. Also, @kbd{C-o} inserts a newline | 529 | type @kbd{C-q @key{SPC}} or @kbd{C-q C-j} respectively. Also, |
| 530 | without line breaking. | 530 | @kbd{C-o} inserts a newline without line breaking. |
| 531 | |||
| 532 | @cindex kinsoku line-breaking rules | ||
| 533 | The place where Auto Fill breaks a line depends on the line's | ||
| 534 | characters. For characters from @acronym{ASCII}, Latin, and most | ||
| 535 | other scripts Emacs breaks a line on space characters, to keep the | ||
| 536 | words intact. But for CJK scripts, a line can be broken between any | ||
| 537 | two characters. (If you load the @file{kinsoku} library, Emacs will | ||
| 538 | avoid breaking a line between certain pairs of CJK characters, where | ||
| 539 | special rules prohibit that.) | ||
| 531 | 540 | ||
| 532 | When Auto Fill mode breaks a line, it tries to obey the | 541 | When Auto Fill mode breaks a line, it tries to obey the |
| 533 | @dfn{adaptive fill prefix}: if a fill prefix can be deduced from the | 542 | @dfn{adaptive fill prefix}: if a fill prefix can be deduced from the |
| @@ -549,6 +558,9 @@ described in the next section. | |||
| 549 | (@pxref{Fill Commands}). | 558 | (@pxref{Fill Commands}). |
| 550 | @end ifnottex | 559 | @end ifnottex |
| 551 | 560 | ||
| 561 | A similar feature that wraps long lines automatically at display | ||
| 562 | time is Visual Line Mode (@pxref{Visual Line Mode}). | ||
| 563 | |||
| 552 | @node Fill Commands | 564 | @node Fill Commands |
| 553 | @subsection Explicit Fill Commands | 565 | @subsection Explicit Fill Commands |
| 554 | 566 | ||
| @@ -571,7 +583,11 @@ Center a line. | |||
| 571 | current paragraph. It redistributes the line breaks within the | 583 | current paragraph. It redistributes the line breaks within the |
| 572 | paragraph, and deletes any excess space and tab characters occurring | 584 | paragraph, and deletes any excess space and tab characters occurring |
| 573 | within the paragraph, in such a way that the lines end up fitting | 585 | within the paragraph, in such a way that the lines end up fitting |
| 574 | within a certain maximum width. | 586 | within a certain maximum width. Like Auto Fill mode, this and other |
| 587 | filling commands usually break lines at space characters, but for CJK | ||
| 588 | characters these commands can break a line between almost any two | ||
| 589 | characters, and they can also obey the kinsoku rules. @xref{Auto | ||
| 590 | Fill}. | ||
| 575 | 591 | ||
| 576 | @findex fill-region | 592 | @findex fill-region |
| 577 | Normally, @kbd{M-q} acts on the paragraph where point is, but if | 593 | Normally, @kbd{M-q} acts on the paragraph where point is, but if |
| @@ -645,8 +661,8 @@ or before @samp{)}, @samp{:} or @samp{?}); and | |||
| 645 | even if preceded by a non-whitespace character). | 661 | even if preceded by a non-whitespace character). |
| 646 | 662 | ||
| 647 | Emacs can display an indicator in the @code{fill-column} position | 663 | Emacs can display an indicator in the @code{fill-column} position |
| 648 | using the Display fill column indicator mode | 664 | using the Display fill column indicator mode (@pxref{Displaying |
| 649 | (@pxref{Displaying Boundaries, display-fill-column-indicator}). | 665 | Boundaries, display-fill-column-indicator}). |
| 650 | 666 | ||
| 651 | @node Fill Prefix | 667 | @node Fill Prefix |
| 652 | @subsection The Fill Prefix | 668 | @subsection The Fill Prefix |
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index e9bef6ec801..6d283bd6f14 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el | |||
| @@ -51,10 +51,12 @@ A value of nil means that any change in indentation starts a new paragraph." | |||
| 51 | 51 | ||
| 52 | (defcustom fill-separate-heterogeneous-words-with-space nil | 52 | (defcustom fill-separate-heterogeneous-words-with-space nil |
| 53 | "Non-nil means to use a space to separate words of a different kind. | 53 | "Non-nil means to use a space to separate words of a different kind. |
| 54 | This will be done with a word in the end of a line and a word in | 54 | For example, when an English word at the end of a line and a CJK word |
| 55 | the beginning of the next line when concatenating them for | 55 | at the beginning of the next line are joined into a single line, they |
| 56 | filling those lines. Whether to use a space depends on how the | 56 | will be separated by a space if this variable is non-nil. |
| 57 | words are categorized." | 57 | Whether to use a space to separate such words also depends on the entry |
| 58 | in `fill-nospace-between-words-table' for the characters before and | ||
| 59 | after the newline." | ||
| 58 | :type 'boolean | 60 | :type 'boolean |
| 59 | :group 'fill | 61 | :group 'fill |
| 60 | :version "26.1") | 62 | :version "26.1") |