emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] emacs-25 25e461c 1/2: Fix visiting files with raw-text


From: Stefan Monnier
Subject: Re: [Emacs-diffs] emacs-25 25e461c 1/2: Fix visiting files with raw-text
Date: Sun, 13 Dec 2015 23:25:28 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>> > -  Fset_buffer_multibyte (Qnil);
>> > +  if (inserted > 0)
>> > +    bset_enable_multibyte_characters (current_buffer, Qnil);
>> > +  else
>> > +    Fset_buffer_multibyte (Qnil);
>> 
>> Hmm... IIUC if (inserted > 0) we need bset_enable_multibyte_characters
>> because Fset_buffer_multibyte would try to convert the chars we
>> just inserted.
>> 
>> And IIUC we recently switched to Fset_buffer_multibyte in order to
>> handle the case where the buffer was not empty when we started (in
>> which case we need to convert the content that was present before we
>> started insertion).
>> 
>> So, IIUC if the buffer was not empty to start with *and* (inserted > 0),
>> then we have a problem because neither function is right.
>> 
>> Or did I miss something?

> If inserted is positive, there's code after that which takes care of
> adjusting the buffer's gap etc.  So it's only needed when nothing was
> inserted.

But if (inserted > 0) and the buffer was not empty beforehand, how can
the subsequent code know (after we've called
bset_enable_multibyte_characters) that it has to decode the earlier
buffer's content (since bset_enable_multibyte_characters has thrown away
the information that the earlier buffer's content was multibyte)?


        Stefan



reply via email to

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