[Top][All Lists]

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

Re: buffer-swap-text

From: Stefan Monnier
Subject: Re: buffer-swap-text
Date: Wed, 22 Oct 2008 23:24:42 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> 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.


reply via email to

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