From: Eli Zaretskii Date: Tue, 20 Apr 2021 12:12:10 +0000 (+0300) Subject: Improve filling-related documentation X-Git-Tag: emacs-28.0.90~2730^2~5 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cad8913c89;p=emacs.git 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. --- 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. @cindex mode, Auto Fill @dfn{Auto Fill} mode is a buffer-local minor mode (@pxref{Minor -Modes}) in which lines are broken automatically at spaces when the -line becomes too wide. +Modes}) in which lines are broken automatically when the line becomes +too wide and you type @kbd{@key{SPC}} or @kbd{@key{RET}}. @table @kbd @item M-x auto-fill-mode @@ -522,12 +522,21 @@ certain major modes, add @code{auto-fill-mode} to the mode hooks (@pxref{Major Modes}). When Auto Fill mode is enabled, the mode indicator @samp{Fill} appears in the mode line (@pxref{Mode Line}). - Auto Fill mode breaks lines automatically at spaces whenever they -get longer than the desired width. This line breaking occurs only -when you type @key{SPC} or @key{RET}. If you wish to insert a space -or newline without permitting line-breaking, type @kbd{C-q @key{SPC}} -or @kbd{C-q C-j} respectively. Also, @kbd{C-o} inserts a newline -without line breaking. + Auto Fill mode breaks lines automatically at the appropriate places +whenever lines get longer than the desired width. This line breaking +occurs only when you type @kbd{@key{SPC}} or @kbd{@key{RET}}. If you +wish to insert a space or newline without permitting line-breaking, +type @kbd{C-q @key{SPC}} or @kbd{C-q C-j} respectively. Also, +@kbd{C-o} inserts a newline without line breaking. + +@cindex kinsoku line-breaking rules + The place where Auto Fill breaks a line depends on the line's +characters. For characters from @acronym{ASCII}, Latin, and most +other scripts Emacs breaks a line on space characters, to keep the +words intact. But for CJK scripts, a line can be broken between any +two characters. (If you load the @file{kinsoku} library, Emacs will +avoid breaking a line between certain pairs of CJK characters, where +special rules prohibit that.) When Auto Fill mode breaks a line, it tries to obey the @dfn{adaptive fill prefix}: if a fill prefix can be deduced from the @@ -549,6 +558,9 @@ described in the next section. (@pxref{Fill Commands}). @end ifnottex + A similar feature that wraps long lines automatically at display +time is Visual Line Mode (@pxref{Visual Line Mode}). + @node Fill Commands @subsection Explicit Fill Commands @@ -571,7 +583,11 @@ Center a line. current paragraph. It redistributes the line breaks within the paragraph, and deletes any excess space and tab characters occurring within the paragraph, in such a way that the lines end up fitting -within a certain maximum width. +within a certain maximum width. Like Auto Fill mode, this and other +filling commands usually break lines at space characters, but for CJK +characters these commands can break a line between almost any two +characters, and they can also obey the kinsoku rules. @xref{Auto +Fill}. @findex fill-region Normally, @kbd{M-q} acts on the paragraph where point is, but if @@ -645,8 +661,8 @@ or before @samp{)}, @samp{:} or @samp{?}); and even if preceded by a non-whitespace character). Emacs can display an indicator in the @code{fill-column} position -using the Display fill column indicator mode -(@pxref{Displaying Boundaries, display-fill-column-indicator}). +using the Display fill column indicator mode (@pxref{Displaying +Boundaries, display-fill-column-indicator}). @node Fill Prefix @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." (defcustom fill-separate-heterogeneous-words-with-space nil "Non-nil means to use a space to separate words of a different kind. -This will be done with a word in the end of a line and a word in -the beginning of the next line when concatenating them for -filling those lines. Whether to use a space depends on how the -words are categorized." +For example, when an English word at the end of a line and a CJK word +at the beginning of the next line are joined into a single line, they +will be separated by a space if this variable is non-nil. +Whether to use a space to separate such words also depends on the entry +in `fill-nospace-between-words-table' for the characters before and +after the newline." :type 'boolean :group 'fill :version "26.1")