comparison lisp/fill.el @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 8626e4521993
children 697ef44129c6
comparison
equal deleted inserted replaced
397:f4aeb21a5bad 398:74fd4e045ea6
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@altair.xemacs.org) converted broken 36 ;; 97/06/11 Steve Baur (steve@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 (if (>= (point) to) 229 (cond ((>= (point) to)
230 (goto-char firstline) 230 (goto-char firstline))
231 (setq at-second t)) 231 ((/= (point) from)
232 (setq at-second t)))
232 (move-to-left-margin) 233 (move-to-left-margin)
233 ;; XEmacs change 234 ;; XEmacs change
234 (let ((start (point)) 235 (let ((start (point))
235 ; jhod: no longer used? 236 ; jhod: no longer used?
236 ;(eol (save-excursion (end-of-line) (point))) 237 ;(eol (save-excursion (end-of-line) (point)))
237 ) 238 )
238 (setq result 239 (setq result
239 (if (not (looking-at paragraph-start)) 240 (if (or dont-skip-first (not (looking-at paragraph-start)))
240 (cond ((and adaptive-fill-regexp (looking-at adaptive-fill-regexp)) 241 (cond ((and adaptive-fill-regexp (looking-at adaptive-fill-regexp))
241 (buffer-substring-no-properties start (match-end 0))) 242 (buffer-substring-no-properties start (match-end 0)))
242 (adaptive-fill-function (funcall adaptive-fill-function))))) 243 (adaptive-fill-function (funcall adaptive-fill-function)))))
243 (and result 244 (and result
244 (or at-second 245 (or at-second
380 (or (eobp) (insert ?\ ?\ ))) 381 (or (eobp) (insert ?\ ?\ )))
381 (goto-char from) 382 (goto-char from)
382 (skip-chars-forward " \t") 383 (skip-chars-forward " \t")
383 ;; Then change all newlines to spaces. 384 ;; Then change all newlines to spaces.
384 ;;; 97/3/14 jhod: Kinsoku change 385 ;;; 97/3/14 jhod: Kinsoku change
385 ;; Spacing is not necessary for charcters of no word-separater. 386 ;; Spacing is not necessary for characters of no word-separator.
386 ;; The regexp word-across-newline is used for this check. 387 ;; The regexp word-across-newline is used for this check.
387 (defvar word-across-newline) 388 (defvar word-across-newline)
388 (if (not (and (featurep 'mule) 389 (if (not (and (featurep 'mule)
389 (stringp word-across-newline))) 390 (stringp word-across-newline)))
390 (subst-char-in-region from (point-max) ?\n ?\ ) 391 (subst-char-in-region from (point-max) ?\n ?\ )
427 (goto-char (point-min)) 428 (goto-char (point-min))
428 429
429 ;; This is the actual filling loop. 430 ;; This is the actual filling loop.
430 (let ((prefixcol 0) linebeg 431 (let ((prefixcol 0) linebeg
431 (re-break-point (if (featurep 'mule) 432 (re-break-point (if (featurep 'mule)
432 (concat "[ \n\t]\\|" word-across-newline) 433 (concat "[ \n\t]\\|" word-across-newline
434 ".\\|." word-across-newline)
433 "[ \n\t]"))) 435 "[ \n\t]")))
434 (while (not (eobp)) 436 (while (not (eobp))
435 (setq linebeg (point)) 437 (setq linebeg (point))
436 (move-to-column (1+ (current-fill-column))) 438 (move-to-column (1+ (current-fill-column)))
437 (if (eobp) 439 (if (eobp)