aboutsummaryrefslogtreecommitdiffstats
path: root/lispref/strings.texi
diff options
context:
space:
mode:
Diffstat (limited to 'lispref/strings.texi')
-rw-r--r--lispref/strings.texi15
1 files changed, 13 insertions, 2 deletions
diff --git a/lispref/strings.texi b/lispref/strings.texi
index 46c01982f32..17a62b546b4 100644
--- a/lispref/strings.texi
+++ b/lispref/strings.texi
@@ -700,8 +700,8 @@ in the copy with encodings of the corresponding @var{objects}. The
700arguments @var{objects} are the computed values to be formatted. 700arguments @var{objects} are the computed values to be formatted.
701 701
702The characters in @var{string}, other than the format specifications, 702The characters in @var{string}, other than the format specifications,
703are copied directly into the output; if they have text properties, 703are copied directly into the output, including their text properties,
704these are copied into the output also. 704if any.
705@end defun 705@end defun
706 706
707@cindex @samp{%} in format 707@cindex @samp{%} in format
@@ -719,6 +719,17 @@ For example:
719@end group 719@end group
720@end example 720@end example
721 721
722 Since @code{format} interprets @samp{%} characters as format
723specifications, you should @emph{never} pass an arbitrary string as
724the first argument. This is particularly true when the string is
725generated by some Lisp code. Unless the string is @emph{known} to
726never include any @samp{%} characters, pass @code{"%s"}, described
727below, as the first argument, and the string as the second, like this:
728
729@example
730 (format "%s" @var{arbitrary-string})
731@end example
732
722 If @var{string} contains more than one format specification, the 733 If @var{string} contains more than one format specification, the
723format specifications correspond to successive values from 734format specifications correspond to successive values from
724@var{objects}. Thus, the first format specification in @var{string} 735@var{objects}. Thus, the first format specification in @var{string}