comparison lisp/fill.el @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 74fd4e045ea6
children 95016f13131a
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
31 ;; All the commands for filling text. These are documented in the XEmacs 31 ;; All the commands for filling text. These are documented in the XEmacs
32 ;; Reference Manual. 32 ;; Reference Manual.
33 33
34 ;; 97/3/14 Jareth Hein (jhod@po.iijnet.or.jp) added functions for kinsoku (asian text 34 ;; 97/3/14 Jareth Hein (jhod@po.iijnet.or.jp) added functions for kinsoku (asian text
35 ;; line break processing) 35 ;; line break processing)
36 ;; 97/06/11 Steve Baur (steve@xemacs.org) converted broken 36 ;; 97/06/11 Steve Baur (steve@altair.xemacs.org) converted broken
37 ;; following-char/preceding-char calls to char-after/char-before. 37 ;; following-char/preceding-char calls to char-after/char-before.
38 38
39 ;;; Code: 39 ;;; Code:
40 40
41 (defgroup fill nil 41 (defgroup fill nil
224 at-second 224 at-second
225 result) 225 result)
226 ;; XEmacs change 226 ;; XEmacs change
227 (if (not dont-skip-first) 227 (if (not dont-skip-first)
228 (forward-line 1)) 228 (forward-line 1))
229 (cond ((>= (point) to) 229 (if (>= (point) to)
230 (goto-char firstline)) 230 (goto-char firstline)
231 ((/= (point) from) 231 (setq at-second t))
232 (setq at-second t)))
233 (move-to-left-margin) 232 (move-to-left-margin)
234 ;; XEmacs change 233 ;; XEmacs change
235 (let ((start (point)) 234 (let ((start (point))
236 ; jhod: no longer used? 235 ; jhod: no longer used?
237 ;(eol (save-excursion (end-of-line) (point))) 236 ;(eol (save-excursion (end-of-line) (point)))
238 ) 237 )
239 (setq result 238 (setq result
240 (if (or dont-skip-first (not (looking-at paragraph-start))) 239 (if (not (looking-at paragraph-start))
241 (cond ((and adaptive-fill-regexp (looking-at adaptive-fill-regexp)) 240 (cond ((and adaptive-fill-regexp (looking-at adaptive-fill-regexp))
242 (buffer-substring-no-properties start (match-end 0))) 241 (buffer-substring-no-properties start (match-end 0)))
243 (adaptive-fill-function (funcall adaptive-fill-function))))) 242 (adaptive-fill-function (funcall adaptive-fill-function)))))
244 (and result 243 (and result
245 (or at-second 244 (or at-second
381 (or (eobp) (insert ?\ ?\ ))) 380 (or (eobp) (insert ?\ ?\ )))
382 (goto-char from) 381 (goto-char from)
383 (skip-chars-forward " \t") 382 (skip-chars-forward " \t")
384 ;; Then change all newlines to spaces. 383 ;; Then change all newlines to spaces.
385 ;;; 97/3/14 jhod: Kinsoku change 384 ;;; 97/3/14 jhod: Kinsoku change
386 ;; Spacing is not necessary for characters of no word-separator. 385 ;; Spacing is not necessary for charcters of no word-separater.
387 ;; The regexp word-across-newline is used for this check. 386 ;; The regexp word-across-newline is used for this check.
388 (defvar word-across-newline) 387 (defvar word-across-newline)
389 (if (not (and (featurep 'mule) 388 (if (not (and (featurep 'mule)
390 (stringp word-across-newline))) 389 (stringp word-across-newline)))
391 (subst-char-in-region from (point-max) ?\n ?\ ) 390 (subst-char-in-region from (point-max) ?\n ?\ )
428 (goto-char (point-min)) 427 (goto-char (point-min))
429 428
430 ;; This is the actual filling loop. 429 ;; This is the actual filling loop.
431 (let ((prefixcol 0) linebeg 430 (let ((prefixcol 0) linebeg
432 (re-break-point (if (featurep 'mule) 431 (re-break-point (if (featurep 'mule)
433 (concat "[ \n\t]\\|" word-across-newline 432 (concat "[ \n\t]\\|" word-across-newline)
434 ".\\|." word-across-newline)
435 "[ \n\t]"))) 433 "[ \n\t]")))
436 (while (not (eobp)) 434 (while (not (eobp))
437 (setq linebeg (point)) 435 (setq linebeg (point))
438 (move-to-column (1+ (current-fill-column))) 436 (move-to-column (1+ (current-fill-column)))
439 (if (eobp) 437 (if (eobp)