From 4e97019a77731d634e6b059954c8fef792c11fa8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 23 Aug 2020 10:10:47 +0300 Subject: [PATCH] Minor fixes for last change * lisp/international/kinsoku.el (kinsoku): Provide 'kinsoku'. * lisp/cus-start.el (standard): Use 'require' instead of 'load. * etc/NEWS: * doc/emacs/display.texi (Visual Line Mode): Improve wording and markup of last change. --- doc/emacs/display.texi | 28 +++++++++++++++------------- etc/NEWS | 9 +++++---- lisp/cus-start.el | 2 +- lisp/international/kinsoku.el | 2 ++ 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index d56a135b640..e7b8745a044 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi @@ -1813,21 +1813,23 @@ variable @code{visual-line-fringe-indicators}. @findex char-category-set @findex category-set-mnemonics By default, Emacs only breaks lines after whitespace characters. -That strategy produces bad results when CJK and Latin text are mixed +That produces incorrect results when CJK and Latin text are mixed together (because CJK characters don't use whitespace to separate -words). You can customize @code{word-wrap-by-category} to allow Emacs -to break lines after any character with ``|'' category +words). You can customize the option @code{word-wrap-by-category} to +allow Emacs to break lines after any character with ``|'' category (@pxref{Categories,,, elisp, the Emacs Lisp Reference Manual}), which -includes CJK characters. Also, if this variable is set using -Customize, Emacs automatically loads kinsoku.el. When kinsoku.el is -loaded, Emacs respects kinsoku rules when breaking lines. That means -characters with the ``>'' category don't appear at the beginning of a -line (e.g., FULLWIDTH COMMA), and characters with the ``<'' category -don't appear at the end of a line (e.g., LEFT DOUBLE ANGLE BRACKET). -You can view the categories of a character by @code{char-category-set} -and @code{category-set-mnemonics}, or type @kbd{C-u C-x =} with point -on the character and look at the ``category'' section in the report. -You can add categories to a character by @code{modify-category-entry}. +provides better support for CJK characters. Also, if this variable is +set using Customize, Emacs automatically loads @file{kinsoku.el}. +When @file{kinsoku.el} is loaded, Emacs respects kinsoku rules when +breaking lines. That means characters with the ``>'' category don't +appear at the beginning of a line (e.g., U+FF0C FULLWIDTH COMMA), and +characters with the ``<'' category don't appear at the end of a line +(e.g., U+300A LEFT DOUBLE ANGLE BRACKET). You can view the category +set of a character using the commands @code{char-category-set} and +@code{category-set-mnemonics}, or by typing @kbd{C-u C-x =} with point +on the character and looking at the ``category'' section in the +report. You can add categories to a character using the command +@code{modify-category-entry}. @node Display Custom @section Customization of Display diff --git a/etc/NEWS b/etc/NEWS index 42713642587..d79cbe76111 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -93,11 +93,12 @@ specify 'cursor-type' to be '(box . SIZE)', the cursor becomes a hollow box if the point is on an image larger than 'SIZE' pixels in any dimension. ++++ ** New custom option 'word-wrap-by-category'. - -When word-wrap is enabled, this option allows Emacs to break lines -after more characters (instead of just whitespace characters), that -means word-wrapping for CJK text mixed with Latin text is improved. +When word-wrap is enabled, and this option is non-nil, that allows +Emacs to break lines after more characters than just whitespace +characters. In particular, this significantly improves word-wrapping +for CJK text mixed with Latin text. --- *** Improved language transliteration in Malayalam input methods. diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 7ecb7b51bec..f5b70e082a5 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -102,7 +102,7 @@ display boolean "28.1" :set (lambda (symbol value) (set-default symbol value) - (when value (load "kinsoku.el")))) + (when value (require 'kinsoku)))) (selective-display-ellipses display boolean) (indicate-empty-lines fringe boolean) (indicate-buffer-boundaries diff --git a/lisp/international/kinsoku.el b/lisp/international/kinsoku.el index 54bf0e95313..4e9b6b015a5 100644 --- a/lisp/international/kinsoku.el +++ b/lisp/international/kinsoku.el @@ -182,4 +182,6 @@ the context of text formatting." (aref (char-category-set (preceding-char)) ?<)) (kinsoku-shorter linebeg)))) +(provide 'kinsoku) + ;;; kinsoku.el ends here -- 2.39.2