From 0147cdd4d96f1eaeef720ee0b89bddd27eaf4233 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 3 Jun 2017 01:31:04 -0700 Subject: [PATCH] =?UTF-8?q?Document=20uniqueness=20limitation=20of=20?= =?UTF-8?q?=E2=80=98format=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/lispref/strings.texi (Formatting Strings): * src/editfns.c (Fformat): Document that field numbers should be unique within a format. --- doc/lispref/strings.texi | 7 ++++--- src/editfns.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index e80e778..f365c80 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -965,9 +965,10 @@ Formatting Strings 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 format can contain either -numbered or unnumbered format specifications but not both, except that address@hidden can be mixed with numbered specifications. +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. @example (format "%2$s, %3$s, %%, %1$s" "x" "y" "z") diff --git a/src/editfns.c b/src/editfns.c index 29af25a..a5088b0 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -3901,9 +3901,10 @@ where field is [0-9]+ followed by a literal dollar "$", flags is followed by [0-9]+. If a %-sequence is numbered with a field with positive value N, the -Nth argument is substituted instead of the next one. A format can -contain either numbered or unnumbered %-sequences but not both, except -that %% can be mixed with numbered %-sequences. +Nth argument is substituted instead of the next one. A field number +should differ from the other field numbers in the same format. A +format can contain either numbered or unnumbered %-sequences but not +both, except that %% can be mixed with numbered %-sequences. The + flag character inserts a + before any positive number, while a space inserts a space before any positive number; these flags only -- 2.7.4