From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: buffer-swap-text and multibyteness Date: Sat, 31 Jan 2009 14:43:37 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233431037 14891 80.91.229.12 (31 Jan 2009 19:43:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 31 Jan 2009 19:43:57 +0000 (UTC) Cc: emacs-devel@gnu.org, handa@m17n.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 31 20:45:11 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 1LTLm8-0005Xv-Gq for ged-emacs-devel@m.gmane.org; Sat, 31 Jan 2009 20:45:08 +0100 Original-Received: from localhost ([127.0.0.1]:56402 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTLkq-0007L0-42 for ged-emacs-devel@m.gmane.org; Sat, 31 Jan 2009 14:43:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LTLkm-0007Kr-Hq for emacs-devel@gnu.org; Sat, 31 Jan 2009 14:43:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LTLkk-0007KB-TC for emacs-devel@gnu.org; Sat, 31 Jan 2009 14:43:44 -0500 Original-Received: from [199.232.76.173] (port=44130 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTLkk-0007K4-N6 for emacs-devel@gnu.org; Sat, 31 Jan 2009 14:43:42 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:62308 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LTLkg-0005z2-Uz; Sat, 31 Jan 2009 14:43:39 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgMFAJM4hEnO+IQk/2dsb2JhbACBbsVmhBQGgmw X-IronPort-AV: E=Sophos;i="4.37,356,1231131600"; d="scan'208";a="33109212" Original-Received: from 206-248-132-36.dsl.teksavvy.com (HELO pastel.home) ([206.248.132.36]) by ironport2-out.teksavvy.com with ESMTP; 31 Jan 2009 14:43:37 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 817DB8229; Sat, 31 Jan 2009 14:43:37 -0500 (EST) In-Reply-To: (Eli Zaretskii's message of "Sat, 31 Jan 2009 21:03:42 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:108468 Archived-At: >> > 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