unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24314: Mistake in GNU Emacs Lisp Reference Manual
@ 2016-08-26 18:07 Eric Wayman
  2016-08-26 19:14 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wayman @ 2016-08-26 18:07 UTC (permalink / raw)
  To: 24314, info

To Whom It May Concern,

I believe I have found a mistake in the GNU Emacs Lisp Reference
Manual.

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).

Best regards,
Eric Wayman





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#24314: Mistake in GNU Emacs Lisp Reference Manual
  2016-08-26 18:07 bug#24314: Mistake in GNU Emacs Lisp Reference Manual Eric Wayman
@ 2016-08-26 19:14 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2016-08-26 19:14 UTC (permalink / raw)
  To: Eric Wayman; +Cc: 24314-done, info

> 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.)





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-26 19:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26 18:07 bug#24314: Mistake in GNU Emacs Lisp Reference Manual Eric Wayman
2016-08-26 19:14 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).