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

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

bug#58168: string-lessp glitches and inconsistencies


From: Mattias Engdegård
Subject: bug#58168: string-lessp glitches and inconsistencies
Date: Tue, 4 Oct 2022 16:44:17 +0200

4 okt. 2022 kl. 13.37 skrev Eli Zaretskii <eliz@gnu.org>:

> First I needed to fix fallout from making STRING_CHAR intolerant of
> unibyte text, because redisplay-testsuite caused assertion violations
> in string_char_and_length.

Good catch! Just to satisfy my curiosity:

>             error ("Invalid format operation %%%c",
> -                  STRING_CHAR ((unsigned char *) format - 1));
> +                  multibyte_format
> +                  ? STRING_CHAR ((unsigned char *) format - 1)
> +                  : *((unsigned char *) format - 1));

This treats unibyte format strings as if they were Latin-1 for the purpose of 
the error message. Not very important, of course, but maybe there should be a 
UNIBYTE_TO_CHAR in the alternative branch?

>  (Doesn't it abort for you? or do you not
> build Emacs with --enable-checking?)

Oh I certainly do that occasionally, but it's mostly when I've changed 
something at the C level or have reason to believe that something is broken 
there.

> I could understand why you'd want to _add_ the larger values, but why
> replace?

Because it seemed pretty clear that the old code intended to use #x3ffffc for 
testing display of raw bytes but a typo turned it into #x3fffc instead which 
isn't a raw byte but a multibyte character. That it's an easy mistake to make 
(done so several times myself).

Thus the change fixes that: it now correctly tests #x3ffffc (multibyte raw byte 
FC) as well as a couple of undisplayable multibyte chars (one C1 control and 
one astral plane unicode value made undisplayable). Now everything should be 
described correctly, which wasn't the case before.

> As for the bug report which led to display-raw-bytes-as-hex (if that
> what you meant) and its discussion, it's bug#27122.

Thank you, but I actually meant the one where it was agreed that it was a good 
idea to display raw bytes and Latin-1 U+0080..009F in the same way. There isn't 
much of a code trail because it probably never was a conscious decision -- it 
just ended up being that way -- but apparently the status quo was 
defended/rationalised at some point.

I've now pushed the patch; the code can be improved further if necessary.






reply via email to

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