emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte b


From: Stefan Monnier
Subject: Re: emacs-26 8f18d12: Improve documentation of decoding into a unibyte buffer
Date: Wed, 29 May 2019 12:28:30 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> In any case, I think we should strive to avoid using "encoded" multibyte
>> strings.
> I don't think it's possible,

"strive to avoid" is always possible.  I didn't say we should completely
disallow it (which might be possible, but it's too far from where we are
to be able to tell).

> because buffers are by default multibyte.

And those contains chars 99,99% of the time.
And buffers that contain bytes are unibyte in most cases.
This is the sane way to work.  It makes it easy to know what is what.

Also, not only it's possible, but it's pretty much the case already.
Whether we'll be able to eliminate all cases, I don't know.  But I think
we should try to make the cases of "decoded text in unibyte" and "encoded
text in multibyte" as rare as possible.

[ Similarly, set-buffer-multibyte should only ever be called in an
  empty buffer.  ]


        Stefan


PS: I added checks in encoding/decoding functions to signal errors when
decoding from multibyte and encoding from unibyte (in my local Emacs),
and that's been tremendously useful to track down and fix encoding bugs
in Gnus.




reply via email to

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