1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

Improved format string error message (bug#58168)

* src/editfns.c (styled_format): Better message when the conversion
char is non-ASCII from a unibyte format string.
This commit is contained in:
Mattias Engdegård 2022-10-07 18:17:40 +02:00
parent 8de7995ae6
commit 71b3a37569

View File

@ -3551,10 +3551,15 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
|| float_conversion || conversion == 'i'
|| conversion == 'o' || conversion == 'x'
|| conversion == 'X'))
error ("Invalid format operation %%%c",
multibyte_format
? STRING_CHAR ((unsigned char *) format - 1)
: *((unsigned char *) format - 1));
{
unsigned char *p = (unsigned char *) format - 1;
if (multibyte_format)
error ("Invalid format operation %%%c", STRING_CHAR (p));
else
error (*p <= 127 ? "Invalid format operation %%%c"
: "Invalid format operation char #o%03o",
*p);
}
else if (! (FIXNUMP (arg) || ((BIGNUMP (arg) || FLOATP (arg))
&& conversion != 'c')))
error ("Format specifier doesn't match argument type");