Mercurial > emacs
changeset 23490:dc320f6914fe
Setup `fill-find-break-point-function'
property to character sets which require `kinsoku' processing for
filling.
(fill-find-break-point): New function.
(fill-region-as-paragraph): Don't check kinsoku-enable here.
Don't call kinsoku directly, intead call fill-find-break-point.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 19 Oct 1998 00:40:10 +0000 |
parents | 09201cebfa21 |
children | 608e86fcce73 |
files | lisp/textmodes/fill.el |
diffstat | 1 files changed, 35 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/fill.el Mon Oct 19 00:40:10 1998 +0000 +++ b/lisp/textmodes/fill.el Mon Oct 19 00:40:10 1998 +0000 @@ -252,6 +252,30 @@ The predicate is called with no arguments, with point at the place to be tested. If it returns t, fill commands do not break the line there.") +(let ((alist '((katakana-jisx0201 . kinsoku) + (chinese-gb2312 . kinsoku) + (japanese-jisx0208 . kinsoku) + (japanese-jisx0212 . kinsoku) + (chinese-big5-1 . kinsoku) + (chinese-big5-2 . kinsoku)))) + (while alist + (put-charset-property (car (car alist)) 'fill-find-break-point-function + (cdr (car alist))) + (setq alist (cdr alist)))) + +(defun fill-find-break-point (charset limit) + "Move point to a proper line wrapping position of the current line. + +CHARSET is a non-ascii character set before or after the current position. +Don't move back past the buffer position LIMIT. + +If CHARSET has the property `fill-find-break-point-function', this +function calls the property value as a function with one arg LINEBEG. +If CHARSET has no such property, do nothing." + (let ((func (get-charset-property charset 'fill-find-break-point-function))) + (if func + (funcall func limit)))) + (defun fill-region-as-paragraph (from to &optional justify nosqueeze squeeze-after) "Fill the region as one paragraph. @@ -474,13 +498,17 @@ (setq first nil))) ;; Normally, move back over the single space between the words. (if (= (preceding-char) ?\ ) (forward-char -1)) - ;; Do KINSOKU processing. - (if (and enable-multibyte-characters enable-kinsoku - (save-excursion - (goto-char (point-min)) - (skip-chars-forward "\0-\177") - (/= (point) (point-max)))) - (kinsoku linebeg))) + + (if enable-multibyte-characters + ;; If we are going to break the line after or + ;; before a non-ascii character, we may have to + ;; run a special function for the charset of the + ;; character to find the correct break point. + (let ((charset (charset-after (1- (point))))) + (if (eq charset 'ascii) + (setq charset (charset-after (point)))) + (if (not (eq charset 'ascii)) + (fill-find-break-point charset linebeg))))) ;; If the left margin and fill prefix by themselves ;; pass the fill-column, keep at least one word.