emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0147cdd: Document uniqueness limitation of ‘format


From: Paul Eggert
Subject: [Emacs-diffs] master 0147cdd: Document uniqueness limitation of ‘format’
Date: Sat, 3 Jun 2017 04:31:58 -0400 (EDT)

branch: master
commit 0147cdd4d96f1eaeef720ee0b89bddd27eaf4233
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Document uniqueness limitation of ‘format’
    
    * 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 @@ 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 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]