Function: preview-string-expand
preview-string-expand is a byte-compiled function defined in
preview.el.
Signature
(preview-string-expand ARG &optional SEPARATOR)
Documentation
Expand ARG as a string.
It can already be a string. Or it can be a list, then it is recursively evaluated using SEPARATOR as separator. If a list element is in itself a CONS cell, the CAR of the list (after symbol dereferencing) can evaluate to either a string, in which case it is used as a separator for the rest of the list, or a boolean (t or nil) in which case the rest of the list is either evaluated and concatenated or ignored, respectively. ARG can be a symbol, and so can be the CDR of a cell used for string concatenation.
Source Code
;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/preview.el
(defun preview-string-expand (arg &optional separator)
"Expand ARG as a string.
It can already be a string. Or it can be a list, then it is
recursively evaluated using SEPARATOR as separator. If a list
element is in itself a CONS cell, the CAR of the list (after symbol
dereferencing) can evaluate to either a string, in which case it is
used as a separator for the rest of the list,
or a boolean (t or nil) in which case the rest of the list is
either evaluated and concatenated or ignored, respectively.
ARG can be a symbol, and so can be the CDR
of a cell used for string concatenation."
(cond
((stringp arg) arg)
((consp arg)
(mapconcat
#'identity
(delq nil
(mapcar
(lambda(x)
(if (consp x)
(let ((sep (car x)))
(while (and (symbolp sep)
(not (memq sep '(t nil))))
(setq sep (symbol-value sep)))
(if (stringp sep)
(preview-string-expand (cdr x) sep)
(and sep
(preview-string-expand (cdr x)))))
(preview-string-expand x)))
arg))
(or separator "")))
((and (symbolp arg) (not (memq arg '(t nil))))
(preview-string-expand (symbol-value arg) separator))
(t (error "Bad string expansion"))))