Function: woman2-nr
woman2-nr is a byte-compiled function defined in woman.el.gz.
Signature
(woman2-nr TO)
Documentation
.nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R.
The increment for auto-incrementing is set to M. Format paragraphs up to TO. (Breaks, but should not!)
Source Code
;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman2-nr (to)
".nr R +/-N M -- Assign +/-N (wrt to previous value, if any) to register R.
The increment for auto-incrementing is set to M.
Format paragraphs up to TO. (Breaks, but should not!)"
(let* ((name (buffer-substring
(point)
(progn (skip-syntax-forward "^ ") (point))))
(pm (progn ; increment
(skip-chars-forward " \t")
(when (memq (char-after) '(?+ ?-))
(forward-char) (char-before))))
(value (if (eolp) ; no value
nil ; to be interpreted as zero
(woman2-process-escapes-to-eol 'numeric)
(woman-parse-numeric-arg)))
(inc (progn ; auto-increment
(skip-chars-forward " \t")
(if (eolp) ; no value
nil ; to be interpreted as zero ???
(woman-parse-numeric-arg))))
(oldvalue (assoc name woman-registers)))
(when oldvalue
(setq oldvalue (cdr oldvalue)) ; (value . inc)
(unless inc (setq inc (cdr oldvalue))))
(cond ((null value)
(setq value 0) ; correct?
(WoMan-warn "nr %s -- null value assigned as zero!" name))
((symbolp value)
(setq value (list 'quote value))))
(if pm ; increment old value
(setq oldvalue (if oldvalue (car oldvalue) 0)
value (if (eq pm ?+)
(+ oldvalue value)
(- oldvalue value))))
(setq woman-registers
(cons (cons name (cons value inc)) woman-registers))
(woman-delete-whole-line)
(woman2-format-paragraphs to)))