Function: preview-do-replacements
preview-do-replacements is a byte-compiled function defined in
preview.el.
Signature
(preview-do-replacements STRING REPLACEMENTS)
Documentation
Perform replacements in string.
STRING is the input string, REPLACEMENTS is a list of replacements. A replacement is a cons-cell, where the car is the match string, and the cdr is a list of strings or symbols. Symbols get dereferenced, and strings get evaluated as replacement strings.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/preview.el
(defun preview-do-replacements (string replacements)
"Perform replacements in string.
STRING is the input string, REPLACEMENTS is a list of replacements.
A replacement is a cons-cell, where the car is the match string,
and the cdr is a list of strings or symbols. Symbols get dereferenced,
and strings get evaluated as replacement strings."
(let (rep case-fold-search)
(while replacements
(setq rep (pop replacements))
(cond ((symbolp rep)
(setq string (preview-do-replacements
string (symbol-value rep))))
((string-match (car rep) string)
(setq string
(mapconcat (lambda(x)
(if (symbolp x)
(symbol-value x)
(replace-match x t nil string)))
(cdr rep) ""))))))
string)