aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-02-26 16:34:36 +0000
committerChong Yidong2008-02-26 16:34:36 +0000
commit6329325d6b89c0fb0cff60fc458dc08cfcdd85de (patch)
tree82b74fd491eb9f82b9d6b185c5483bcd613e6d37
parent6667db4e2122bd90f0058049a604e584226dbfd9 (diff)
downloademacs-6329325d6b89c0fb0cff60fc458dc08cfcdd85de.tar.gz
emacs-6329325d6b89c0fb0cff60fc458dc08cfcdd85de.zip
(Fformat): Doc fix.
-rw-r--r--src/editfns.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/editfns.c b/src/editfns.c
index a8e9c8603bb..c9acebd9d29 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3383,7 +3383,10 @@ DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
3383 doc: /* Format a string out of a format-string and arguments. 3383 doc: /* Format a string out of a format-string and arguments.
3384The first argument is a format control string. 3384The first argument is a format control string.
3385The other arguments are substituted into it to make the result, a string. 3385The other arguments are substituted into it to make the result, a string.
3386It may contain %-sequences meaning to substitute the next argument. 3386
3387The format control string may contain %-sequences meaning to substitute
3388the next available argument:
3389
3387%s means print a string argument. Actually, prints any object, with `princ'. 3390%s means print a string argument. Actually, prints any object, with `princ'.
3388%d means print as number in decimal (%o octal, %x hex). 3391%d means print as number in decimal (%o octal, %x hex).
3389%X is like %x, but uses upper case. 3392%X is like %x, but uses upper case.
@@ -3393,12 +3396,34 @@ It may contain %-sequences meaning to substitute the next argument.
3393 or decimal-point notation, whichever uses fewer characters. 3396 or decimal-point notation, whichever uses fewer characters.
3394%c means print a number as a single character. 3397%c means print a number as a single character.
3395%S means print any object as an s-expression (using `prin1'). 3398%S means print any object as an s-expression (using `prin1').
3396 The argument used for %d, %o, %x, %e, %f, %g or %c must be a number. 3399
3400The argument used for %d, %o, %x, %e, %f, %g or %c must be a number.
3397Use %% to put a single % into the output. 3401Use %% to put a single % into the output.
3398 3402
3399The basic structure of a %-sequence is 3403A %-sequence may contain optional flag, width, and precision
3400 % <flags> <width> <precision> character 3404specifiers, as follows:
3401where flags is [-+ #0]+, width is [0-9]+, and precision is .[0-9]+ 3405
3406 %<flags><width><precision>character
3407
3408where flags is [+ #-0]+, width is [0-9]+, and precision is .[0-9]+
3409
3410The + flag character inserts a + before any positive number, while a
3411space inserts a space before any positive number; these flags only
3412affect %d, %e, %f, and %g sequences, and the + flag takes precedence.
3413The # flag means to use an alternate display form for %o, %x, %X, %e,
3414%f, and %g sequences. The - and 0 flags affect the width specifier,
3415as described below.
3416
3417The width specifier supplies a lower limit for the length of the
3418printed representation. The padding, if any, normally goes on the
3419left, but it goes on the right if the - flag is present. The padding
3420character is normally a space, but it is 0 if the 0 flag is present.
3421The - flag takes precedence over the 0 flag.
3422
3423For %e, %f, and %g sequences, the number after the "." in the
3424precision specifier says how many decimal places to show; if zero, the
3425decimal point itself is omitted. For %s and %S, the precision
3426specifier truncates the string to the given width.
3402 3427
3403usage: (format STRING &rest OBJECTS) */) 3428usage: (format STRING &rest OBJECTS) */)
3404 (nargs, args) 3429 (nargs, args)