diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-06-04 08:39:37 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-06-04 08:42:53 -0700 |
commit | d5fcf9e458053af1c50f0d4dad4c59db056790e5 (patch) | |
tree | f6fe65eb1823c49d771d520c4e6d66b92525ac2d /doc | |
parent | 6ad42aecc243d378d38468fd3efd89bc1fbfb187 (diff) | |
download | emacs-d5fcf9e458053af1c50f0d4dad4c59db056790e5.tar.gz |
Tune ‘format’ after recent fix
* doc/lispref/strings.texi (Formatting Strings):
* src/editfns.c (Fformat): Format field numbers no longer need
to be unique, reverting the previous doc change since that has
now been fixed. Also, document that %% should not have modifiers.
* src/editfns.c (styled_format): Improve performance. Remove
the need for the new prepass over the format string, by using
a typically-more-generous bound for the info array size.
Initialize the info array lazily. Move string inspection to
the same area to help caching. Avoid the need for a
converted_to_string bitfield by using EQ. Cache arg in a
local and avoid some potential aliasing issues to help the
compiler. Info array is now 0-origin, not 1-origin.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lispref/strings.texi | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index f365c80493d..23961f99efd 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -926,7 +926,8 @@ digit. @item %% Replace the specification with a single @samp{%}. This format -specification is unusual in that it does not use a value. For example, +specification is unusual in that its only form is plain +@samp{%%} and that it does not use a value. For example, @code{(format "%% %d" 30)} returns @code{"% 30"}. @end table @@ -965,10 +966,9 @@ extra values to be formatted are ignored. decimal number immediately after the initial @samp{%}, followed by a literal dollar sign @samp{$}. It causes the format specification to convert the argument with the given number instead of the next -argument. Field numbers start at 1. A field number should differ -from the other field numbers in the same format. A format can contain -either numbered or unnumbered format specifications but not both, -except that @samp{%%} can be mixed with numbered specifications. +argument. Field numbers start at 1. A format can contain either +numbered or unnumbered format specifications but not both, except that +@samp{%%} can be mixed with numbered specifications. @example (format "%2$s, %3$s, %%, %1$s" "x" "y" "z") @@ -1026,8 +1026,7 @@ ignored. A specification can have a @dfn{width}, which is a decimal number that appears after any field number and flags. If the printed representation of the object contains fewer characters than this -width, @code{format} extends it with padding. The width is -ignored for the @samp{%%} specification. Any padding introduced by +width, @code{format} extends it with padding. Any padding introduced by the width normally consists of spaces inserted on the left: @example |