Function: woman-if-body
woman-if-body is a byte-compiled function defined in woman.el.gz.
Signature
(woman-if-body REQUEST TO DELETE)
Documentation
Process if-body, including Keymap ... \ is not currently defined..
REQUEST is the invoking directive without the leading dot. If TO is non-nil then delete the if-body. If DELETE is non-nil then delete from point.
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
;; request is not used dynamically by any callees.
(defun woman-if-body (request to delete) ; should be reversed as `accept'?
"Process if-body, including \\{ ... \\}.
REQUEST is the invoking directive without the leading dot.
If TO is non-nil then delete the if-body.
If DELETE is non-nil then delete from point."
;; Assume concealed newlines already processed.
(let ((from (point)))
(if to (delete-region (point) to))
(delete-horizontal-space)
(cond (;;(looking-at "[^{\n]*\\\\{\\s *") ; multi-line
;; allow escaped newlines:
(looking-at "[^{\n]*\\(\\\\\n\\)*\\\\{\\s *\\(\\\\\n\\)*") ; multi-line
;; including preceding .if(s) and following newline
(let ((from (point)))
(woman-delete-match 0)
;; Allow for nested \{ ... \} -- BUT BEWARE that this
;; algorithm only supports one level of nesting!
(while
(and (re-search-forward
;; "\\(\\\\{\\)\\|\\(\n[.']\\)?[ \t]*\\\\}[ \t]*"
;; Interpret bogus `el \}' as `el \{',
;; especially for Tcl/Tk man pages:
"\\(\\\\{\\|el[ \t]*\\\\}\\)\\|\\(\n[.']\\)?[ \t]*\\\\}[ \t]*")
(match-beginning 1))
(re-search-forward "\\\\}"))
(delete-region (if delete from (match-beginning 0)) (point))
(if (looking-at "^$") (delete-char 1))
))
(delete (woman-delete-line 1))) ; single-line
;; Process matching .el anything:
(cond ((string= request "ie")
;; Discard unless previous .ie c `evaluated to false'.
;; IIUC, an .ie must be followed by an .el.
;; (An if with no else uses .if rather than .ie.)
;; TODO warn if no .el found?
;; The .el should come immediately after the .ie (modulo
;; comments etc), but this searches to eob.
(cond ((re-search-forward "^[.'][ \t]*el[ \t]*" nil t)
(woman-delete-match 0)
(woman-if-body "el" nil (not delete)))))
;;; FIXME neither the comment nor the code here make sense to me.
;;; This branch was executed for an else (any else, AFAICS).
;;; At this point, the else in question has already been processed above.
;;; The re-search will find the _next_ else, if there is one, and
;;; delete it. If there is one, it belongs to another if block. (Bug#9447)
;;; woman0-el does not need this bit either.
;; Got here after processing a single-line `.ie' as a body
;; clause to be discarded:
;;; ((string= request "el")
;;; (cond ((re-search-forward "^[.'][ \t]*el[ \t]*" nil t)
;;; (woman-delete-match 0)
;;; (woman-if-body "el" nil t)))))
)
(goto-char from)))