Subject: Re: bug#4655: 23.1.50; buffer-swap-text oddity

From: Stefan Monnier <[email-masked]>
Date: Wed, 07 Oct 2009 01:41:40 -0400

> Why do you expect buffer-swap-text to switch the current buffer?

I'm not sure he expects it.  And if he does, I can't tell you why, so
I'll pass.

> And, why it is doing it?

I don't think it does when not called within save-excursion.
But when called within the save-excursion, the reason is simple:

1- markers are swapped along with the buffer texts (with a some
   exceptions, mostly window-markers).
2- save-excursion saves the "position and current buffer" as a marker.

Combine 1 and 2 together, and you'll see that save-excursion ends up
changing the current buffer.

        Stefan