From unknown Fri Jun 20 07:18:25 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#10114 <10114@debbugs.gnu.org> To: bug#10114 <10114@debbugs.gnu.org> Subject: Status: 24.0.91; (not (eq (current-buffer) (window-buffer (selected-window)))) Reply-To: bug#10114 <10114@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:18:25 +0000 retitle 10114 24.0.91; (not (eq (current-buffer) (window-buffer (selected-w= indow)))) reassign 10114 emacs submitter 10114 Richard Copley severity 10114 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 22 18:13:00 2011 Received: (at submit) by debbugs.gnu.org; 22 Nov 2011 23:13:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RSzWO-00084U-38 for submit@debbugs.gnu.org; Tue, 22 Nov 2011 18:13:00 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RSzWL-00084L-9W for submit@debbugs.gnu.org; Tue, 22 Nov 2011 18:12:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSzV0-00011x-9Q for submit@debbugs.gnu.org; Tue, 22 Nov 2011 18:11:35 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:57312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSzV0-00011t-7u for submit@debbugs.gnu.org; Tue, 22 Nov 2011 18:11:34 -0500 Received: from eggs.gnu.org ([140.186.70.92]:36922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSzUz-0001NS-94 for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2011 18:11:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RSzUy-00011h-At for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2011 18:11:33 -0500 Received: from mail-qw0-f48.google.com ([209.85.216.48]:48392) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RSzUy-00011d-8a for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2011 18:11:32 -0500 Received: by qam2 with SMTP id 2so1025042qam.0 for ; Tue, 22 Nov 2011 15:11:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=x/QSsC9wonGuhvIGKML1YaVxPKYeJEdRtN5V63yi1tI=; b=vT06Qpq0Q/hR0zyfdOumfLpEcIAnbWmCQyjMblG0s1lZQrjSRsVgIdH5oDN355BWng UL1UaxCSTKnOBBJHzU79G6cdUmolLGNvi61/frOynJxtVfrRxlvtpa4t1ls0L+Nqw6s8 HybG916XQBc6TJzd+VxMz+SrYjSjfuL8pDmyE= MIME-Version: 1.0 Received: by 10.182.77.196 with SMTP id u4mr7944837obw.19.1322003491276; Tue, 22 Nov 2011 15:11:31 -0800 (PST) Received: by 10.182.15.42 with HTTP; Tue, 22 Nov 2011 15:11:31 -0800 (PST) Date: Tue, 22 Nov 2011 23:11:31 +0000 Message-ID: Subject: 24.0.91; (not (eq (current-buffer) (window-buffer (selected-window)))) From: Richard Copley To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.7 (-----) 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*; [...] (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)' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: ENG value of $XMODIFIERS: nil locale-coding-system: cp1252 default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x r e p o r t - e m a c s - b u g Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr message format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader emacsbug time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 23 05:08:14 2011 Received: (at 10114-done) by debbugs.gnu.org; 23 Nov 2011 10:08:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RT9kT-0007Ea-VG for submit@debbugs.gnu.org; Wed, 23 Nov 2011 05:08:14 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1RT9kR-0007ER-G1 for 10114-done@debbugs.gnu.org; Wed, 23 Nov 2011 05:08:12 -0500 Received: (qmail invoked by alias); 23 Nov 2011 10:06:45 -0000 Received: from 62-47-42-114.adsl.highway.telekom.at (EHLO [62.47.42.114]) [62.47.42.114] by mail.gmx.net (mp069) with SMTP; 23 Nov 2011 11:06:45 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19dSL0G2NxdyIfBiBg1ilCOoulzDo4nrA6GRjkPwI KgNtgYkZ/lXcP2 Message-ID: <4ECCC5B4.5080504@gmx.at> Date: Wed, 23 Nov 2011 11:06:44 +0100 From: martin rudalics User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: 10114-done@debbugs.gnu.org Subject: Re: bug#10114: 24.0.91; (not (eq (current-buffer) (window-buffer (selected-window)))) References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 10114-done Cc: Richard Copley X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) > 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 From unknown Fri Jun 20 07:18:25 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 21 Dec 2011 12:24:02 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator