emacs-devel
[Top][All Lists]
Advanced

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

Re: distinguishing multibyte/unibyte ASCII


From: Alain Schneble
Subject: Re: distinguishing multibyte/unibyte ASCII
Date: Fri, 9 Sep 2016 23:02:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Stefan Monnier <address@hidden> writes:

>> If you just generate an ASCII string from ASCII characters, it will
>> usually be unibyte.  If you take it as a substring from a multibyte
>> buffer, it will usually be multibyte.
>
> And it's arguably a wart in Emacs's handling of chars-vs-bytes.
> But it's kind of hard to fix now.
>
> At some point I tried to change this handling (not exactly fix it) by
> treating multibyte ASCII strings specially (it's easy to recognize by
> checking that the char length is equal to the byte length and both are
> readily available in the "struct Lisp_String" object).  Then when we
> read an ASCII string, instead of making it unibyte, I'd keep it as
> multibyte.  And then change things like "concat" so that those "ASCII
> multibyte" strings don't force the result to be multibyte.
>
> My local Emacs still runs with those changes, but in the end I don't
> think the result is really better (or sufficiently better to justify
> the subtle incompatibilities it introduces).

I'm relieved to hear that :)  Thanks for sharing it.




reply via email to

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