emacs-devel
[Top][All Lists]
Advanced

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

Re: buffer-swap-text and multibyteness


From: Stefan Monnier
Subject: Re: buffer-swap-text and multibyteness
Date: Sat, 31 Jan 2009 14:43:37 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> > set-buffer-multibyte jumps through the hoops to DTRT.
>> > By contrast, in buffer-swap-text we do just this:
>> 
>> >   swapfield (enable_multibyte_characters, Lisp_Object);
>> 
>> > Could this cause trouble, e.g. if one of the buffers whose text is
>> > swapped contains eight-bit characters?
>> 
>> Why would it?  The text is swapped along with the
>> enable_multibyte_characters field, so they should stay consistent.

> I don't know, perhaps I was just confused.  It's hard not to be, with
> all that mind-boggling swapping that goes on in Rmail between a
> unibyte buffer and a multibyte one.  A horrible design, if you ask me.
> It's little surprise to me that I found so many bugs in Rmail due to
> this (and more are still there): one needs constantly to track the
> current state of the ``swappiness'', or else all bets are off.
> (Quick: if you are currently in rmail-view-buffer, and
> rmail-buffers-swapped-p returns non-nil, is the text unibyte or
> multibyte?)

I haven't looked at the code recently, but it does sound like an
undesirable state of affairs, indeed.  In tar-mode (and the way I imagine
buffer-swap-text to be used), swapping the buffer is a rare operation
that's basically only done when the the major mode changes.


        Stefan




reply via email to

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