]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
elisp-format: Accept null precision.
authorBruno Haible <bruno@clisp.org>
Sat, 21 Jun 2025 22:54:23 +0000 (00:54 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 21 Jun 2025 22:54:23 +0000 (00:54 +0200)
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.

gettext-tools/src/format-elisp.c
gettext-tools/tests/format-elisp-1

index 5e0e54ce0b99264aea1ade5059fa18b1a6f041d5..819aa6c9fa65902492ea71dfb63116d192718f6d 100644 (file)
@@ -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,
index f95dda03dc018c54cb5f7512f78218e44c5b301d..0f5bb5f107fcfec21e4b9cac0ab0a6260149537b 100755 (executable)
@@ -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