Function: woman2-process-escapes
woman2-process-escapes is a byte-compiled function defined in
woman.el.gz.
Signature
(woman2-process-escapes TO &optional NUMERIC)
Documentation
Process remaining escape sequences up to marker TO, preserving point.
Optional argument NUMERIC, if non-nil, means the argument is numeric.
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The following function should probably do ALL width and number
;; register interpolation.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun woman2-process-escapes (to &optional numeric)
"Process remaining escape sequences up to marker TO, preserving point.
Optional argument NUMERIC, if non-nil, means the argument is numeric."
(cl-assert (and (markerp to) (marker-insertion-type to)))
;; The first two cases below could be merged (maybe)!
(let ((from (point)))
;; Discard zero width filler character used to hide leading dots
;; and zero width characters.
(while (re-search-forward "\\\\[&|^]" to t)
(woman-delete-match 0)
;; If on a line by itself, consume newline as well (Bug#3651).
;; But not in a .nf region, preserve all newlines in that case.
(and (not woman-nofill)
(eq (char-before (match-beginning 0)) ?\n)
(eq (char-after (match-beginning 0)) ?\n)
(delete-char 1)))
(goto-char from)
;; Interrupt text processing -- CONTINUE current text with the
;; next text line (after any control lines, unless processing to
;; eol):
(while (re-search-forward "\\\\c.*\n?" to t)
(woman-delete-match 0))
;; but do not delete the final newline ...
(if (and (or (eobp) (= (point) to)) (not (bolp)))
(insert-before-markers ?\n))
(goto-char from)
(woman-translate to)
(goto-char from)
(woman-special-characters to)
(goto-char from)
;; Printable version of the current escape character, ASSUMED to be `\'
;; This must be done LAST of all escape processing!
;; Done like this to preserve any text properties of the `\'
(while (search-forward "\\" to t)
(let ((c (following-char)))
;; Some other escapes, such as \f, are handled in
;; `woman0-process-escapes'.
(cond ((eq c ?') ; \' -> '
(delete-char -1)
(cond (numeric ; except in numeric args, \' -> `
(delete-char 1)
(insert ?`))))
((eq c ?\( )) ; uninterpreted special character
; \(.. -- do nothing
((eq c ?t) ; non-interpreted tab \t
(delete-char 1)
(delete-char -1)
(insert "\t"))
((and numeric
(memq c '(?w ?n ?h)))) ; leave \w, \n, \h (?????)
((eq c ?l) (woman-horizontal-line)))))
(goto-char from)
;; Process non-default tab settings:
(cond (tab-stop-list
(while (search-forward "\t" to t)
(woman-tab-to-tab-stop))
(goto-char from)))
;; Must replace \' by something before processing \w, done above.
;; Replace all `\w' and `\n' escapes:
;; (This may be a bit too recursive!)
(while (re-search-forward "\\\\[nw]" to t)
(let ((from (match-beginning 0)) N)
(goto-char from)
(setq N (woman-parse-numeric-value))
(delete-region from (point))
;; Interpolate value:
(insert-before-markers (number-to-string N))))
(goto-char from)))