From: Bruno Haible Date: Sat, 21 Jun 2025 22:54:23 +0000 (+0200) Subject: elisp-format: Accept null precision. X-Git-Tag: v0.26~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d29d2aa61a1be2fe47310b5e3ef5887748c6032c;p=thirdparty%2Fgettext.git elisp-format: Accept null precision. Proof that is is valid: (format "%.f" 3.1415926) * gettext-tools/src/format-elisp.c: Fix comment regarding the precision. * gettext-tools/tests/format-elisp-1: Add a test case with null precision. --- diff --git a/gettext-tools/src/format-elisp.c b/gettext-tools/src/format-elisp.c index 5e0e54ce0..819aa6c9f 100644 --- a/gettext-tools/src/format-elisp.c +++ b/gettext-tools/src/format-elisp.c @@ -31,8 +31,8 @@ #define _(str) gettext (str) -/* Emacs Lisp format strings are implemented in emacs-21.1/src/editfns.c, - xemacs-21.1.14/src/editfns.c and xemacs-21.1.14/src/doprnt.c. +/* Emacs Lisp format strings are implemented in emacs-21.4/src/editfns.c and + emacs-21.4/src/doprnt.c. A directive - starts with '%' or '%m$' where m is a positive integer, - is optionally followed by any of the characters '#', '0', '-', ' ', '+', @@ -40,7 +40,7 @@ - is optionally followed by a width specification: '*' (reads an argument) or a nonempty digit sequence, - is optionally followed by '.' and a precision specification: '*' (reads - an argument) or a nonempty digit sequence, + an argument) or an optional nonempty digit sequence, - is finished by a specifier - '%', that needs no argument, - 'c', that need a character argument, diff --git a/gettext-tools/tests/format-elisp-1 b/gettext-tools/tests/format-elisp-1 index f95dda03d..0f5bb5f10 100755 --- a/gettext-tools/tests/format-elisp-1 +++ b/gettext-tools/tests/format-elisp-1 @@ -54,6 +54,8 @@ cat <<\EOF > f-el-1.data "abc%y" # Invalid: flags after width "abc%2^d" +# Valid: null precision +"abc%.f" # Invalid: twice precision "abc%.4.2d" # Valid: three arguments