unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: rms@gnu.org
Cc: eliz@gnu.org, emacs-devel@gnu.org
Subject: Re: buffer-swap-text
Date: Wed, 22 Oct 2008 23:24:42 -0400	[thread overview]
Message-ID: <jwvbpxcvvy8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1KsqWP-00013X-CT@fencepost.gnu.org> (Richard M. Stallman's message of "Wed, 22 Oct 2008 23:06:01 -0400")

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




  reply	other threads:[~2008-10-23  3:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 10:42 buffer-swap-text Eli Zaretskii
2008-10-21 13:56 ` buffer-swap-text Stefan Monnier
2008-10-21 15:30   ` buffer-swap-text Eli Zaretskii
2008-10-21 22:04     ` buffer-swap-text Stefan Monnier
2008-10-21 19:40 ` buffer-swap-text Richard M. Stallman
2008-10-21 22:06   ` buffer-swap-text Stefan Monnier
2008-10-23  3:06     ` buffer-swap-text Richard M. Stallman
2008-10-23  3:24       ` Stefan Monnier [this message]
2008-10-23 21:09         ` buffer-swap-text Richard M. Stallman
2008-10-24  4:05           ` buffer-swap-text Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvbpxcvvy8.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).