From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#12208: yes-or-no-p escapes with-current-buffer Date: Fri, 17 Aug 2012 14:09:38 +0200 Message-ID: <502E3482.5060300@gmx.at> References: <502CBF82.3080601@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345205415 27221 80.91.229.3 (17 Aug 2012 12:10:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2012 12:10:15 +0000 (UTC) Cc: 12208@debbugs.gnu.org To: Steve Hafner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 17 14:10:13 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T2LNV-0003u6-5r for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 14:10:13 +0200 Original-Received: from localhost ([::1]:46852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2LNT-000835-U6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 08:10:11 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2LNR-000830-BN for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2012 08:10:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T2LNP-0000Ta-So for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2012 08:10:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2LNP-0000TF-PS for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2012 08:10:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1T2LW1-0000Qo-Nm for bug-gnu-emacs@gnu.org; Fri, 17 Aug 2012 08:19:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 Aug 2012 12:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12208 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 12208-submit@debbugs.gnu.org id=B12208.13452059311639 (code B ref 12208); Fri, 17 Aug 2012 12:19:01 +0000 Original-Received: (at 12208) by debbugs.gnu.org; 17 Aug 2012 12:18:51 +0000 Original-Received: from localhost ([127.0.0.1]:35045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T2LVr-0000QN-61 for submit@debbugs.gnu.org; Fri, 17 Aug 2012 08:18:51 -0400 Original-Received: from mailout-de.gmx.net ([213.165.64.23]:48112) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1T2LVo-0000QE-4E for 12208@debbugs.gnu.org; Fri, 17 Aug 2012 08:18:49 -0400 Original-Received: (qmail invoked by alias); 17 Aug 2012 12:09:45 -0000 Original-Received: from 62-47-38-189.adsl.highway.telekom.at (EHLO [62.47.38.189]) [62.47.38.189] by mail.gmx.net (mp001) with SMTP; 17 Aug 2012 14:09:45 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18ocUwqvOgobWpo2HFbz4LFBrVaeMDKbN2xn/3Ph3 MbPCMgmOaKCOSt In-Reply-To: X-Y-GMX-Trusted: 0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:63247 Archived-At: > Thanks for the examples. I wrote them as a first step in order to uncouple the behavior you observed from `yes-or-no-p'. > If I understand correctly, > save-window-excursion ends with among other things restoring the > window points; and each time a window point is set, the buffer point > is set as well. Conceptually, for any non-selected window, it should restore `window-point' but leave `point' for that window's buffer alone. For the selected window, it should leave `point' where it is. The problem seems to occur only when the selected window's buffer is not current at the time the configuration is saved. > And while the current buffer is restored, > save-window-excursion does not restore the point in the current > buffer, leaving it at the position set by the window point restore, if > there was one. Did you read the code? Can you tell me where it does do that "window point restore" which also sets the buffer's `point'? > What I don't understand is the rationale for not > restoring the current buffer point. Perhaps it's just windows have > precedence in a restore. I've never been able to fully understand neither the purpose nor the actual implementation of this. The patch below seems to make it go away in your case but I have no idea whether it breaks something else. martin === modified file 'src/window.c' --- src/window.c 2012-08-16 07:58:24 +0000 +++ src/window.c 2012-08-17 11:56:55 +0000 @@ -5636,8 +5636,9 @@ /* As documented in Fcurrent_window_configuration, don't restore the location of point in the buffer which was current when the window configuration was recorded. */ - if (!EQ (p->buffer, new_current_buffer) - && XBUFFER (p->buffer) == current_buffer) + if (EQ (p->buffer, new_current_buffer)) + Fgoto_char (make_number (old_point)); + else if (XBUFFER (p->buffer) == current_buffer) Fgoto_char (w->pointm); } else if (!NILP (w->buffer)