aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa1998-10-19 00:40:10 +0000
committerKenichi Handa1998-10-19 00:40:10 +0000
commit97323804943da750d50113dbffb34e7ec0bb0f7b (patch)
tree8b5935e4eae18c244db628a0985f70509fe61c90
parentc1a08b4c81b86edeae97fac439a25124b017863a (diff)
downloademacs-97323804943da750d50113dbffb34e7ec0bb0f7b.tar.gz
emacs-97323804943da750d50113dbffb34e7ec0bb0f7b.zip
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.
-rw-r--r--lisp/textmodes/fill.el42
1 files changed, 35 insertions, 7 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 534e5e9d754..e96d20ace1c 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -252,6 +252,30 @@ act as a paragraph-separator."
252The predicate is called with no arguments, with point at the place 252The predicate is called with no arguments, with point at the place
253to be tested. If it returns t, fill commands do not break the line there.") 253to be tested. If it returns t, fill commands do not break the line there.")
254 254
255(let ((alist '((katakana-jisx0201 . kinsoku)
256 (chinese-gb2312 . kinsoku)
257 (japanese-jisx0208 . kinsoku)
258 (japanese-jisx0212 . kinsoku)
259 (chinese-big5-1 . kinsoku)
260 (chinese-big5-2 . kinsoku))))
261 (while alist
262 (put-charset-property (car (car alist)) 'fill-find-break-point-function
263 (cdr (car alist)))
264 (setq alist (cdr alist))))
265
266(defun fill-find-break-point (charset limit)
267 "Move point to a proper line wrapping position of the current line.
268
269CHARSET is a non-ascii character set before or after the current position.
270Don't move back past the buffer position LIMIT.
271
272If CHARSET has the property `fill-find-break-point-function', this
273function calls the property value as a function with one arg LINEBEG.
274If CHARSET has no such property, do nothing."
275 (let ((func (get-charset-property charset 'fill-find-break-point-function)))
276 (if func
277 (funcall func limit))))
278
255(defun fill-region-as-paragraph (from to &optional justify 279(defun fill-region-as-paragraph (from to &optional justify
256 nosqueeze squeeze-after) 280 nosqueeze squeeze-after)
257 "Fill the region as one paragraph. 281 "Fill the region as one paragraph.
@@ -474,13 +498,17 @@ space does not end a sentence, so don't break a line there."
474 (setq first nil))) 498 (setq first nil)))
475 ;; Normally, move back over the single space between the words. 499 ;; Normally, move back over the single space between the words.
476 (if (= (preceding-char) ?\ ) (forward-char -1)) 500 (if (= (preceding-char) ?\ ) (forward-char -1))
477 ;; Do KINSOKU processing. 501
478 (if (and enable-multibyte-characters enable-kinsoku 502 (if enable-multibyte-characters
479 (save-excursion 503 ;; If we are going to break the line after or
480 (goto-char (point-min)) 504 ;; before a non-ascii character, we may have to
481 (skip-chars-forward "\0-\177") 505 ;; run a special function for the charset of the
482 (/= (point) (point-max)))) 506 ;; character to find the correct break point.
483 (kinsoku linebeg))) 507 (let ((charset (charset-after (1- (point)))))
508 (if (eq charset 'ascii)
509 (setq charset (charset-after (point))))
510 (if (not (eq charset 'ascii))
511 (fill-find-break-point charset linebeg)))))
484 512
485 ;; If the left margin and fill prefix by themselves 513 ;; If the left margin and fill prefix by themselves
486 ;; pass the fill-column, keep at least one word. 514 ;; pass the fill-column, keep at least one word.