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

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

bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffer


From: Augusto Stoffel
Subject: bug#50560: 28.0.50; 'insert-file-contents-literally' on multibyte buffers
Date: Mon, 13 Sep 2021 14:44:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Mon, 13 Sep 2021 at 14:52, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Augusto Stoffel <arstoffel@gmail.com>
>> Date: Mon, 13 Sep 2021 08:58:06 +0200
>> 
>> I thought 'insert-file-contents-literally' literally just inserted the
>> file contents, as bytes, but I noticed that in the following code
>> 
>>     (create-image
>>      (with-temp-buffer
>>        (set-buffer-multibyte nil)
>>        (insert-file-contents-literally "picure.jpg")
>>        (buffer-substring-no-properties (point-min) (point-max)))
>>      nil t)
>> 
>> the call to 'set-buffer-multibyte' is really essential.
>
> It is only essential for some very specific uses of the resulting
> buffer, but definitely not for all.

That's a good point.  Maybe the issue is actually with 'create-image',
which seems to only work correctly when the data is passed as a unibyte
string, but gives no warning if you pass a multibyte one.





reply via email to

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