Function: woman2-format-paragraphs
woman2-format-paragraphs is a byte-compiled function defined in
woman.el.gz.
Signature
(woman2-format-paragraphs TO &optional NEW-LEFT)
Documentation
Indent, fill and adjust paragraphs upto TO to current left margin.
If optional arg NEW-LEFT is non-nil then reset current left margin.
If woman-nofill is non-nil then indent without filling or adjusting.
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman2-format-paragraphs (to &optional new-left)
"Indent, fill and adjust paragraphs upto TO to current left margin.
If optional arg NEW-LEFT is non-nil then reset current left margin.
If `woman-nofill' is non-nil then indent without filling or adjusting."
;; Blank space should only ever be output before text.
(if new-left (setq left-margin new-left))
(if (looking-at "^\\s *$")
;; A blank line should leave a space like .sp 1 (p. 14).
(setq woman-leave-blank-lines 1))
(skip-syntax-forward " ")
;; Successive control lines are sufficiently common to be worth a
;; special case (maybe):
(unless (>= (point) to)
(woman-reset-nospace)
(woman2-process-escapes to 'numeric)
(if woman-nofill
;; Indent without filling or adjusting ...
(progn
(woman-leave-blank-lines)
(when woman-temp-indent
(indent-to woman-temp-indent)
(forward-line))
(indent-rigidly (point) to left-margin)
(woman-horizontal-escapes to))
;; Fill and justify ...
;; Blank lines and initial spaces cause a break.
(while (< (point) to)
(woman-leave-blank-lines)
(let ((from (point)))
;; Indent first lin of paragraph:
(indent-to (or woman-temp-indent left-margin))
(woman-horizontal-escapes to) ; 7 October 1999
;; Find the beginning of the next paragraph:
(forward-line)
(and (re-search-forward "\\(^\\s *$\\)\\|\\(^\\s +\\)" to 1)
;; A blank line should leave a space like .sp 1 (p. 14).
(eolp)
(skip-syntax-forward " ")
(setq woman-leave-blank-lines 1))
;; This shouldn't happen, but in case it does (e.g. for
;; badly-formatted manfiles with no terminating newline),
;; avoid an infinite loop.
(unless (and (eolp) (eobp))
(beginning-of-line))
;; If a single short line then just leave it.
;; This is necessary to preserve some table layouts.
;; PROBABLY NOT NECESSARY WITH SQUEEZE MODIFICATION !!!!!
(when (or (> (count-lines from (point)) 1)
(save-excursion
(backward-char)
(> (current-column) fill-column)))
;; NOSQUEEZE has no effect if JUSTIFY is full, so redefine
;; canonically-space-region, see above.
(if (and woman-temp-indent (< woman-temp-indent left-margin))
(let ((left-margin woman-temp-indent))
(fill-region-as-paragraph from (point) woman-justify)
(save-excursion
(goto-char from)
(forward-line)
(setq from (point)))))
(fill-region-as-paragraph from (point) woman-justify)))))
(setq woman-temp-indent nil)))