Function: woman2-tr

woman2-tr is a byte-compiled function defined in woman.el.gz.

Signature

(woman2-tr TO)

Documentation

.tr abcde -- Translate a -> b, c -> d, ..., e -> space.

Format paragraphs up to TO. Supports special chars.
(Breaks, but should not.)

Source Code

;; Defined in /usr/src/emacs/lisp/woman.el.gz
(defun woman2-tr (to)
  ".tr abcde -- Translate a -> b, c -> d, ..., e -> space.
Format paragraphs up to TO.  Supports special chars.
\(Breaks, but should not.)"
  ;; This should be an update, but consing onto the front of the alist
  ;; has the same effect and match duplicates should not matter.
  ;; Initialize translation data structures:
  (let ((matches (car woman-translations))
	(alist (cdr woman-translations))
	a b)
    ;; `matches' must be a string:
    (setq matches
	  (concat (if matches (substring matches 1 -1)) "]"))
    ;; Process .tr arguments:
    (while (not (eolp))			; (looking-at "[ \t]*$") ???
      (setq a (woman-get-next-char))
      (if (eolp)
	  (setq b " ")
	(setq b (woman-get-next-char)))
      (setq matches
	    (if (= (length a) 1)
		(concat a matches)
	      (concat matches "\\|\\" a))
	    alist (cons (cons a b) alist)))
    (delete-char 1)			; no blank line
    ;; Rebuild translations list:
    (setq matches
	  (if (= (string-to-char matches) ?\])
	      (substring matches 3)
	    (concat "[" matches))
	  woman-translations (cons matches alist))
    ;; Format any following text:
    (woman2-format-paragraphs to)))