;{{{}}}
;{{{  fill-line subroutine, not for user access
(defmac fill-line (
  goto-counter fill-column
  if test-end-line
  (
    ;{{{  line to short
    ;{{{  count missing chars
    set-counter X 1
    while test-end-line (
      backward-character
      add-counter X 1)
    ;}}}
    ;{{{  get data from next line
    next-line
    goto-counter X
    if test-end-line (
      ;{{{  next line to short
      goto 1
      if not(or(test-char " ,test-char ".)) (
        delete-previous-character
        "  next-line
        if test-text (
          goto 1
          if and(not(test-char ".),not(test-char " )) (
            previous-line fill-line
          ) else (
            previous-line
          ) fi
        ) else (
          previous-line
        ) fi
      ) else (
        exit
      ) fi
      ;}}}
    ) else (
      ;{{{  split next line
      while and(not(test-char " ),not(test-begin-line)) (backward-character)
      if not(test-begin-line) (
        forward-character
        newline-and-indent
        previous-line
        delete-previous-character
        "  ;
      ) else (
        previous-line
      )fi
      ;}}}
    ) fi
    ;}}}
    ;}}}
  )
  else
  (
    forward-character
    if not(test-end-line)
    (
      backward-character
      ;{{{  line to long
      while and(not(test-begin-line),not(test-char " )) (backward-character)
      if test-begin-line (message-exit "line-longer-than-block) fi
      if not(test-begin-line) (
        forward-character
        newline-and-indent
        goto 1
        while test-char "  (delete-character)
        previous-line
      ) fi
      ;}}}
    ) fi
  ) fi
))
;}}}

(deffun fill-paragraph (
  if counter-0 fill-column (set-counter fill-column 72) fi
  goto 1
  while and(test-text,and(not(test-char ".),not(test-char " )))
  (
    fill-line
    next-line
    goto 1
  )
))

(deffun set-fill-column (store-pos fill-column))
