From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Markus Rost Newsgroups: gmane.emacs.bugs Subject: bug#4655: 23.1.50; buffer-swap-text oddity Date: Wed, 7 Oct 2009 10:53:51 +0200 (CEST) Message-ID: <20091007085351.502A2EFCF2@sonic02.math.uni-bielefeld.de> References: <20091006184604.9A5B2EFE6F@sonic02.math.uni-bielefeld.de> Reply-To: Markus Rost , 4655@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1254906522 13933 80.91.229.12 (7 Oct 2009 09:08:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Oct 2009 09:08:42 +0000 (UTC) Cc: lekktu@gmail.com, 4655@emacsbugs.donarmstrong.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 07 11:08:32 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MvSUW-0002SB-Az for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Oct 2009 11:07:24 +0200 Original-Received: from localhost ([127.0.0.1]:37563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvSUV-0002eA-KD for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Oct 2009 05:07:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvSUP-0002d8-LF for bug-gnu-emacs@gnu.org; Wed, 07 Oct 2009 05:07:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvSUK-0002aq-Ch for bug-gnu-emacs@gnu.org; Wed, 07 Oct 2009 05:07:16 -0400 Original-Received: from [199.232.76.173] (port=47885 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvSUK-0002al-80 for bug-gnu-emacs@gnu.org; Wed, 07 Oct 2009 05:07:12 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:40952) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MvSUJ-0001xL-EN for bug-gnu-emacs@gnu.org; Wed, 07 Oct 2009 05:07:11 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n97979oh007982; Wed, 7 Oct 2009 02:07:09 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n97904Ln005725; Wed, 7 Oct 2009 02:00:04 -0700 Resent-Date: Wed, 7 Oct 2009 02:00:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Markus Rost Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Wed, 07 Oct 2009 09:00:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4655 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4655-submit@emacsbugs.donarmstrong.com id=B4655.12549056404716 (code B ref 4655); Wed, 07 Oct 2009 09:00:03 +0000 Original-Received: (at 4655) by emacsbugs.donarmstrong.com; 7 Oct 2009 08:54:00 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from xen16.math.uni-bielefeld.de (xen16.math.uni-bielefeld.de [129.70.14.14]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n978rvWt004711 for <4655@emacsbugs.donarmstrong.com>; Wed, 7 Oct 2009 01:53:59 -0700 Original-Received: from sonic02.math.uni-bielefeld.de (sonic02.math.uni-bielefeld.de [129.70.14.134]) by xen16.math.uni-bielefeld.de (Postfix) with ESMTP id 5DC2630072C2; Wed, 7 Oct 2009 10:53:52 +0200 (CEST) Original-Received: by sonic02.math.uni-bielefeld.de (Postfix, from userid 3710) id 502A2EFCF2; Wed, 7 Oct 2009 10:53:51 +0200 (CEST) In-reply-to: (message from Stefan Monnier on Wed, 07 Oct 2009 01:41:40 -0400) X-GNU-Emacs-Mailer: GNU Emacs 22.3 X-Home-Page: http://www.math.uni-bielefeld.de/~rost X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Wed, 07 Oct 2009 05:07:16 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:31757 Archived-At: Juanma wrote: > I would expect A/A both with and > without it (and I'm quite surprised to find that it is not so). Exactly. > Why do you expect buffer-swap-text to switch the current buffer? I don't. See below for the concrete situation which led to my example. Stefan wrote: > 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. That explains what happened, thanks. But 2- is not obvious from the documentation of save-excursion. And the conclusion "save-excursion ends up changing the current buffer" is very, very surprising. Since I am not the only one to be surprised, it seems to me that if save-excursion/buffer-swap-text keeps having this behavior, it should be documented, perhaps with a warning for lisp programmers. ========== Here is the concrete scenario which induced my buffer-swap-text example: I have set (defadvice rmail-cease-edit (after update-rmail-summary preactivate) "Recompute Summary-line immediately." (rmail-summary)) I expected this to behave like hitting 'h' after editing an rmail buffer. But I get an error: rmail-new-summary: No RMAIL buffer found The reason is that rmail-cease-edit contains the piece (save-excursion (rmail-show-message) (rmail-toggle-header (if pruned 1 0)))) and rmail-show-message has some buffer/text swapping in it. Moreover, the swap partner rmail-view-buffer (an odd name by the way) doesn't know its rmail-buffer (maybe it should?), so calling rmail-summary from it triggers the error. ========== On a general note: Thank you for all the great developments in Emacs 22/23. Markus