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 Date: Wed, 22 Oct 2008 23:24:42 -0400 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 1224732321 15526 80.91.229.12 (23 Oct 2008 03:25:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Oct 2008 03:25:21 +0000 (UTC) Cc: eliz@gnu.org, emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 23 05:26:21 2008 connect(): Connection refused 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 1Ksqq4-0002FY-SK for ged-emacs-devel@m.gmane.org; Thu, 23 Oct 2008 05:26:21 +0200 Original-Received: from localhost ([127.0.0.1]:34039 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ksqoy-0008HJ-DN for ged-emacs-devel@m.gmane.org; Wed, 22 Oct 2008 23:25:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ksqot-0008Gh-Fu for emacs-devel@gnu.org; Wed, 22 Oct 2008 23:25:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ksqor-0008FX-Su for emacs-devel@gnu.org; Wed, 22 Oct 2008 23:25:07 -0400 Original-Received: from [199.232.76.173] (port=36695 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ksqor-0008FN-Q2 for emacs-devel@gnu.org; Wed, 22 Oct 2008 23:25:05 -0400 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]:42153 helo=ironport2-out.teksavvy.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ksqok-00004q-L8; Wed, 22 Oct 2008 23:24:59 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqAEAOOL/0hFxLrB/2dsb2JhbACBdr4pg06BCw X-IronPort-AV: E=Sophos;i="4.33,468,1220241600"; d="scan'208";a="28752184" Original-Received: from 69-196-186-193.dsl.teksavvy.com (HELO ceviche.home) ([69.196.186.193]) by ironport2-out.teksavvy.com with ESMTP; 22 Oct 2008 23:24:44 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 356ACB4099; Wed, 22 Oct 2008 23:24:42 -0400 (EDT) In-Reply-To: (Richard M. Stallman's message of "Wed, 22 Oct 2008 23:06:01 -0400") 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:104888 Archived-At: >> We need to address the general question of what C-x C-s should do in a >> buffer where you have done the swap. I think your question is part of >> that question. > This depends on the use case. > We have seen two use cases, which are somewhat similar. > What do they do? Is there one approach that would work for both? > I think we need a feature that lets one buffer point to the other > and say "save that one instead". And swapping should turn this > on and off. So when Rmail or Arc mode swaps the buffers, it should > make the visible buffer point to the other one saying "save that instead". > And when it unswaps them, it should reverse that, making the hidden buffer > point to the visible one saying "save that instead". > So here's the proposed feature. > 1. A buffer-local variable buffer-save-other-buffer. > 2. If that is non-nil, it should be a buffer, and `basic-save-buffer' > saves that buffer instead. > 3. When `buffer-swap-text' sees that buffer A's > buffer-save-other-buffer points to buffer B, it "swaps" that, making > buffer B's buffer-save-other-buffer point to buffer A instead. > If the mode doesn't use the buffer-save-other-buffer feature, that > variable will be nil in both buffers, so `buffer-swap-text' won't > change it. I don't see any benefit to hardcode this in buffer-swap-text. We may very well rename buffer-swap-text to buffer-swap-text-internal and introduce a new buffer-swap-text which can perform such things (probably using write-region-annotation-function), as well as swap variables like buffer-file-coding-system. I'd rather we first get more experience with it to see how it's used in practice. Stefan