Mercurial > emacs
comparison lisp/textmodes/fill.el @ 90625:81b116fa69ab
Don't use charset property
`fill-find-break-point-function'.
(fill-find-break-point-function-table): New variable.
(fill-find-break-point): Lookup
fill-find-break-point-function-table.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 23 Oct 2006 01:56:24 +0000 |
parents | a1a25ac6c88a |
children | 6408dbfc7b6a |
comparison
equal
deleted
inserted
replaced
90624:aef420141a41 | 90625:81b116fa69ab |
---|---|
366 ;; which follows as a reason to return t. | 366 ;; which follows as a reason to return t. |
367 (and (not (eolp)) | 367 (and (not (eolp)) |
368 (looking-at paragraph-start)))) | 368 (looking-at paragraph-start)))) |
369 (run-hook-with-args-until-success 'fill-nobreak-predicate))))) | 369 (run-hook-with-args-until-success 'fill-nobreak-predicate))))) |
370 | 370 |
371 ;; Put `fill-find-break-point-function' property to charsets which | 371 (defvar fill-find-break-point-function-table |
372 ;; require special functions to find line breaking point. | 372 (let ((table (make-char-table nil))) |
373 (dolist (pair '((katakana-jisx0201 . kinsoku) | 373 ;; Register `kinsoku' for scripts HAN, KANA, BOPOMPFO, and CJK-MISS. |
374 (chinese-gb2312 . kinsoku) | 374 (map-char-table #'(lambda (key val) |
375 (japanese-jisx0208 . kinsoku) | 375 (if (memq val '(han kana bopomofo cjk-misc)) |
376 (japanese-jisx0212 . kinsoku) | 376 (set-char-table-range table key 'kinsoku))) |
377 (chinese-big5-1 . kinsoku) | 377 char-script-table) |
378 (chinese-big5-2 . kinsoku))) | 378 ;; Register `kinsoku" also for full width characters. |
379 (put-charset-property (car pair) 'fill-find-break-point-function (cdr pair))) | 379 (set-char-table-range table '(#xFF01 . #xFF61) 'kinsoku) |
380 (set-char-table-range table '(#xFFE0 . #xFFE6) 'kinsoku) | |
381 table) | |
382 "Char-table of special functions to find line breaking point.") | |
380 | 383 |
381 (defun fill-find-break-point (limit) | 384 (defun fill-find-break-point (limit) |
382 "Move point to a proper line breaking position of the current line. | 385 "Move point to a proper line breaking position of the current line. |
383 Don't move back past the buffer position LIMIT. | 386 Don't move back past the buffer position LIMIT. |
384 | 387 |
385 This function is called when we are going to break the current line | 388 This function is called when we are going to break the current line |
386 after or before a non-ASCII character. If the charset of the | 389 after or before a non-ASCII character. If the charset of the |
387 character has the property `fill-find-break-point-function', this | 390 character has the property `fill-find-break-point-function', this |
388 function calls the property value as a function with one arg LINEBEG. | 391 function calls the property value as a function with one arg LINEBEG. |
389 If the charset has no such property, do nothing." | 392 If the charset has no such property, do nothing." |
390 (let* ((ch (following-char)) | 393 (let ((func (or |
391 (charset (char-charset ch)) | 394 (aref fill-find-break-point-function-table (following-char)) |
392 func) | 395 (aref fill-find-break-point-function-table (preceding-char))))) |
393 (if (eq charset 'ascii) | |
394 (setq ch (preceding-char) | |
395 charset (char-charset ch))) | |
396 (if (charsetp charset) | |
397 (setq func | |
398 (get-charset-property charset 'fill-find-break-point-function))) | |
399 (if (and func (fboundp func)) | 396 (if (and func (fboundp func)) |
400 (funcall func limit)))) | 397 (funcall func limit)))) |
401 | 398 |
402 (defun fill-delete-prefix (from to prefix) | 399 (defun fill-delete-prefix (from to prefix) |
403 "Delete the fill prefix from every line except the first. | 400 "Delete the fill prefix from every line except the first. |