aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2021-04-20 15:12:10 +0300
committerEli Zaretskii2021-04-20 15:12:10 +0300
commitcad8913c89fa2c15d6d6ac4fe0c63b6731981472 (patch)
tree4688a8abd50fdb0b844633caa08957d21b5afeec
parent2b7eed23eb3aff338b737cce91d22bb464259a1a (diff)
downloademacs-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.texi38
-rw-r--r--lisp/textmodes/fill.el10
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
505Modes}) in which lines are broken automatically at spaces when the 505Modes}) in which lines are broken automatically when the line becomes
506line becomes too wide. 506too 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
523indicator @samp{Fill} appears in the mode line (@pxref{Mode Line}). 523indicator @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
526get longer than the desired width. This line breaking occurs only 526whenever lines get longer than the desired width. This line breaking
527when you type @key{SPC} or @key{RET}. If you wish to insert a space 527occurs only when you type @kbd{@key{SPC}} or @kbd{@key{RET}}. If you
528or newline without permitting line-breaking, type @kbd{C-q @key{SPC}} 528wish to insert a space or newline without permitting line-breaking,
529or @kbd{C-q C-j} respectively. Also, @kbd{C-o} inserts a newline 529type @kbd{C-q @key{SPC}} or @kbd{C-q C-j} respectively. Also,
530without 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
534characters. For characters from @acronym{ASCII}, Latin, and most
535other scripts Emacs breaks a line on space characters, to keep the
536words intact. But for CJK scripts, a line can be broken between any
537two characters. (If you load the @file{kinsoku} library, Emacs will
538avoid breaking a line between certain pairs of CJK characters, where
539special 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
562time 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.
571current paragraph. It redistributes the line breaks within the 583current paragraph. It redistributes the line breaks within the
572paragraph, and deletes any excess space and tab characters occurring 584paragraph, and deletes any excess space and tab characters occurring
573within the paragraph, in such a way that the lines end up fitting 585within the paragraph, in such a way that the lines end up fitting
574within a certain maximum width. 586within a certain maximum width. Like Auto Fill mode, this and other
587filling commands usually break lines at space characters, but for CJK
588characters these commands can break a line between almost any two
589characters, and they can also obey the kinsoku rules. @xref{Auto
590Fill}.
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
645even if preceded by a non-whitespace character). 661even 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
648using the Display fill column indicator mode 664using the Display fill column indicator mode (@pxref{Displaying
649(@pxref{Displaying Boundaries, display-fill-column-indicator}). 665Boundaries, 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.
54This will be done with a word in the end of a line and a word in 54For example, when an English word at the end of a line and a CJK word
55the beginning of the next line when concatenating them for 55at the beginning of the next line are joined into a single line, they
56filling those lines. Whether to use a space depends on how the 56will be separated by a space if this variable is non-nil.
57words are categorized." 57Whether to use a space to separate such words also depends on the entry
58in `fill-nospace-between-words-table' for the characters before and
59after the newline."
58 :type 'boolean 60 :type 'boolean
59 :group 'fill 61 :group 'fill
60 :version "26.1") 62 :version "26.1")