Function: woman2-roff-buffer
woman2-roff-buffer is a byte-compiled function defined in woman.el.gz.
Signature
(woman2-roff-buffer)
Documentation
Process breaks. Format paragraphs and headings.
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
;;; VERTICAL FORMATTING -- Formatting macros that cause a break:
;; Vertical spacing philosophy:
;; Delete all vertical space as it is encountered. Then insert
;; vertical space only before text, as required.
(defun woman2-roff-buffer ()
"Process breaks. Format paragraphs and headings."
(let ((case-fold-search t)
(to (make-marker))
(woman-registers woman-registers)
fn woman-request woman-translations
tab-stop-list)
(set-marker-insertion-type to t)
;; ?roff does not squeeze multiple spaces, but does fill, so...
(cl-letf (((symbol-function 'canonically-space-region) #'ignore)
;; Try to avoid spaces inheriting underlines from preceding text!
((symbol-function 'insert-and-inherit) #'insert)
((symbol-function 'set-text-properties) #'ignore))
(while
;; Find next control line:
(re-search-forward woman-request-regexp nil t)
(cond
;; Construct woman function to call:
((setq fn (intern-soft
(concat "woman2-"
(setq woman-request (match-string 1)))))
;; Delete request or macro name:
(woman-delete-match 0))
;; Unrecognized request:
((prog1 nil
;; (WoMan-warn ".%s request ignored!" woman-request)
(WoMan-warn-ignored woman-request "ignored!")
;; (setq fn 'woman2-LP)
;; AVOID LEAVING A BLANK LINE!
;; (setq fn 'woman2-format-paragraphs)
))
;; .LP assumes it is at eol and leaves a (blank) line,
;; so leave point at end of line before paragraph:
((or (looking-at "[ \t]*$") ; no argument
woman-ignore) ; ignore all
;; (beginning-of-line) (kill-line)
;; AVOID LEAVING A BLANK LINE!
(beginning-of-line) (woman-delete-line 1))
(t (end-of-line) (insert ?\n)))
(if (not (or fn
(and (not (memq (following-char) '(?. ?')))
(setq fn 'woman2-format-paragraphs))))
()
;; Find next control line:
(if (equal woman-request "TS")
(set-marker to (woman-find-next-control-line "TE"))
(set-marker to (woman-find-next-control-line)))
;; Call the appropriate function:
(funcall fn to)))
(if (not (eobp)) ; This should not happen, but ...
(woman2-format-paragraphs (copy-marker (point-max) t)
woman-left-margin)))
(set-marker to nil)))