From: martin rudalics <rudalics@gmx.at>
To: 10114-done@debbugs.gnu.org
Cc: Richard Copley <rcopley@gmail.com>
Subject: bug#10114: 24.0.91; (not (eq (current-buffer) (window-buffer (selected-window))))
Date: Wed, 23 Nov 2011 11:06:44 +0100 [thread overview]
Message-ID: <4ECCC5B4.5080504@gmx.at> (raw)
In-Reply-To: <CAPM58og6-i1cqiL8tLLBASKv_XfLCgbY6Ye1733YqUZ4XB1cmQ@mail.gmail.com>
> When you remove the current buffer from the selected window,
> the buffer that gets displayed in the selected window isn't always
> the same as the buffer that gets made the new current buffer.
> The command M-x test (see below) manifests the problem
> for me from runemacs -Q.
>
> Output on Emacs 23.3:
> Current: *Test*<2>; Selected: *Test*<2>; [...]
> Current: *Test*<1>; Selected: *Test*<1>; [...]
>
> Output on Emacs bzr trunk:
> Current: *Test*<2>; Selected: *Test*<2>; [...]
> Current: *Test*<1>; Selected: *scratch*; [...]
The output on Emacs bzr trunk should be
Current: *Test*<2>; Selected: *Test*<2>; [...]
Current: *scratch*; Selected: *scratch*; [...]
because *scratch* was the buffer shown before *Test*<2>*.
> (defun test ()
> (interactive)
> (progn
> ;; This seems to sow enough confusion.
> (switch-to-buffer-other-window "*Test*<1>")
> (switch-to-buffer-other-window "*Test*<2>")
> (delete-other-windows))
> (while
> (progn
> (message
> "Current: %s; Selected: %s; \
> type k to kill current buffer, \
> any other key to quit"
> (current-buffer)
> (window-buffer (selected-window)))
> (and (eq (read-event) ?k)
> (kill-buffer))))
> (clear-this-command-keys t))
>
> In GNU Emacs 24.0.91.1 (i386-mingw-nt6.1.7601)
> of 2011-11-20 on MACHINE
> Windowing system distributor `Microsoft Corp.', version 6.1.7601
> configured using `configure --with-gcc (4.6)'
The problems happens because `kill-buffer' makes another buffer current
when killing the current buffer and calls `replace-buffer-in-windows'
which ends up calling `switch-to-prev-buffer' for the selected window.
The latter refuses to change the current buffer because the selected
window's buffer is _not_ the current buffer (a behavior needed to make
`switch-to-prev-buffer' work within buffer excursions).
So the solution is to have `kill-buffer' call `replace-buffer-in-windows'
_before_ making another buffer current.
Thanks for the excellent report, martin
prev parent reply other threads:[~2011-11-23 10:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 23:11 bug#10114: 24.0.91; (not (eq (current-buffer) (window-buffer (selected-window)))) Richard Copley
2011-11-23 10:06 ` martin rudalics [this message]
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=4ECCC5B4.5080504@gmx.at \
--to=rudalics@gmx.at \
--cc=10114-done@debbugs.gnu.org \
--cc=rcopley@gmail.com \
/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).