Function: ert-propertized-string
ert-propertized-string is a byte-compiled function defined in
ert-x.el.gz.
Signature
(ert-propertized-string &rest ARGS)
Documentation
Return a string with properties as specified by ARGS.
ARGS is a list of strings and plists. The strings in ARGS are concatenated to produce an output string. In the output string, each string from ARGS will be have the preceding plist as its property list, or no properties if there is no plist before it.
As a simple example,
(ert-propertized-string "foo " '(face italic) "bar" " baz" nil " quux")
would return the string "foo bar baz quux" where the substring
"bar baz" has a face property with the value italic.
None of the ARGS are modified, but the return value may share structure with the plists in ARGS.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/ert-x.el.gz
(defun ert-propertized-string (&rest args)
"Return a string with properties as specified by ARGS.
ARGS is a list of strings and plists. The strings in ARGS are
concatenated to produce an output string. In the output string,
each string from ARGS will be have the preceding plist as its
property list, or no properties if there is no plist before it.
As a simple example,
\(ert-propertized-string \"foo \" \\='(face italic) \"bar\" \" baz\" nil \
\" quux\")
would return the string \"foo bar baz quux\" where the substring
\"bar baz\" has a `face' property with the value `italic'.
None of the ARGS are modified, but the return value may share
structure with the plists in ARGS."
(with-temp-buffer
(cl-loop with current-plist = nil
for x in args do
(cl-etypecase x
(string (let ((begin (point)))
(insert x)
(set-text-properties begin (point) current-plist)))
(list (unless (zerop (mod (length x) 2))
(error "Odd number of args in plist: %S" x))
(setq current-plist x))))
(buffer-string)))