From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: buffer-swap-text and multibyteness Date: Sat, 31 Jan 2009 21:03:42 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1233428709 7982 80.91.229.12 (31 Jan 2009 19:05:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Jan 2009 19:05:09 +0000 (UTC) Cc: emacs-devel@gnu.org, handa@m17n.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 31 20:06:23 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LTL9S-0001jU-Gk for ged-emacs-devel@m.gmane.org; Sat, 31 Jan 2009 20:05:43 +0100 Original-Received: from localhost ([127.0.0.1]:43632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTL89-00011i-PG for ged-emacs-devel@m.gmane.org; Sat, 31 Jan 2009 14:03:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LTL86-00011d-6T for emacs-devel@gnu.org; Sat, 31 Jan 2009 14:03:46 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LTL85-00011C-9O for emacs-devel@gnu.org; Sat, 31 Jan 2009 14:03:45 -0500 Original-Received: from [199.232.76.173] (port=45185 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTL85-000117-48 for emacs-devel@gnu.org; Sat, 31 Jan 2009 14:03:45 -0500 Original-Received: from mtaout1.012.net.il ([84.95.2.1]:19111) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LTL84-0006Bt-Hv for emacs-devel@gnu.org; Sat, 31 Jan 2009 14:03:44 -0500 Original-Received: from conversion-daemon.i-mtaout1.012.net.il by i-mtaout1.012.net.il (HyperSendmail v2007.08) id <0KEC00500NI87200@i-mtaout1.012.net.il> for emacs-devel@gnu.org; Sat, 31 Jan 2009 21:04:01 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.109.18]) by i-mtaout1.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KEC000ORNMND8H0@i-mtaout1.012.net.il>; Sat, 31 Jan 2009 21:04:00 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108467 Archived-At: > From: Stefan Monnier > Cc: Kenichi Handa , emacs-devel@gnu.org > Date: Sat, 31 Jan 2009 12:12:55 -0500 > > > 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?) We should have simply used 2 separate buffers.