bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24314: Mistake in GNU Emacs Lisp Reference Manual


From: Eli Zaretskii
Subject: bug#24314: Mistake in GNU Emacs Lisp Reference Manual
Date: Fri, 26 Aug 2016 22:14:25 +0300

> Date: Fri, 26 Aug 2016 14:07:19 -0400
> From: Eric Wayman <ericwayman@fastmail.fm>
> 
> In section 4.7, Formatting Strings
> (https://www.gnu.org/software/emacs/manual/html_node/elisp/Formatting-Strings.html#Formatting-Strings)
> it says:
> 
>     "The precision is a decimal-point ‘.’ followed by a digit-string...
>     Precision has no effect for other specification characters."
> 
> However, running
> 
>     (format "%.10d" 23)
> 
> produces
> 
>     0000000023
> 
> which clearly does have an effect (i.e. padding the integer with zeroes
> to the left).

Thanks.  This is already fixed in the development sources of what
will become Emacs 25.1.  The manual now says:

     All the specification characters allow an optional “precision” before
  the character (after the width, if present).  The precision is a
  decimal-point ‘.’ followed by a digit-string.  For the floating-point
  specifications (‘%e’, ‘%f’, ‘%g’), the precision specifies how many
  decimal places to show; if zero, the decimal-point itself is also
  omitted.  For ‘%s’ and ‘%S’, the precision truncates the string to the
  given width, so ‘%.3s’ shows only the first three characters of the
  representation for OBJECT.  For other specification characters, the
  effect of precision is what the local library functions of the ‘printf’
  family produce.

(I clarified the last sentence just now.)





reply via email to

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