GNU bug report logs - #36497
pop-to-buffer + quit-window negates with-current-buffer

Previous Next

Package: emacs;

Reported by: Stefan Kangas <stefan <at> marxist.se>

Date: Thu, 4 Jul 2019 12:23:01 UTC

Severity: normal

Tags: notabug

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36497 in the body.
You can then email your comments to 36497 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#36497; Package emacs. (Thu, 04 Jul 2019 12:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Kangas <stefan <at> marxist.se>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 04 Jul 2019 12:23:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: bug-gnu-emacs <at> gnu.org
Subject: pop-to-buffer + quit-window negates with-current-buffer
Date: Thu, 4 Jul 2019 14:22:28 +0200
[Message part 1 (text/plain, inline)]
Steps to reproduce:

0. Run emacs -Q
1. Evaluate the following in *scratch* buffer:

(with-current-buffer (get-buffer-create "foo")
  (pop-to-buffer (get-buffer-create "bar"))
  (quit-window)
  (current-buffer))

Result:
#<buffer *scratch*>

Expected result:
#<buffer foo>

Please find attached also a suggested test case for this bug.

In GNU Emacs 27.0.50 (build 3, x86_64-apple-darwin15.6.0, NS
appkit-1404.47 Version 10.11.6 (Build 15G22010))
 of 2019-07-04 built on Stefans-MBP
Repository revision: 5b48dab412c61980bca63a67a5d548d07e56b404
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1404
System Description:  Mac OS X 10.11.6
[with-current-buffer-test.diff (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36497; Package emacs. (Thu, 04 Jul 2019 12:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 36497 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Kangas <stefan <at> marxist.se>, 36497 <at> debbugs.gnu.org
Subject: Re: bug#36497: pop-to-buffer + quit-window negates with-current-buffer
Date: Thu, 4 Jul 2019 14:50:52 +0200
> Steps to reproduce:
>
> 0. Run emacs -Q
> 1. Evaluate the following in *scratch* buffer:
>
> (with-current-buffer (get-buffer-create "foo")
>    (pop-to-buffer (get-buffer-create "bar"))
>    (quit-window)
>    (current-buffer))
>
> Result:
> #<buffer *scratch*>
>
> Expected result:
> #<buffer foo>

Both 'pop-to-buffer' and 'quit-window' may call 'select-window' which
implicitly makes that window's buffer current.  In the case at hand,
'quit-window' deletes the window of *bar* since it didn't exist
before, selects the window selected before 'pop-to-buffer' was called
and makes that window's buffer current.  So the current behavior is
the expected one.

martin




Added tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 04 Jul 2019 19:35:01 GMT) Full text and rfc822 format available.

Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Thu, 04 Jul 2019 19:35:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan Kangas <stefan <at> marxist.se>:
bug acknowledged by developer. (Thu, 04 Jul 2019 19:35:02 GMT) Full text and rfc822 format available.

Message #15 received at 36497-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 36497-done <at> debbugs.gnu.org
Subject: Re: bug#36497: pop-to-buffer + quit-window negates with-current-buffer
Date: Thu, 4 Jul 2019 21:33:54 +0200
martin rudalics <rudalics <at> gmx.at> writes:
> Both 'pop-to-buffer' and 'quit-window' may call 'select-window' which
> implicitly makes that window's buffer current.  In the case at hand,
> 'quit-window' deletes the window of *bar* since it didn't exist
> before, selects the window selected before 'pop-to-buffer' was called
> and makes that window's buffer current.  So the current behavior is
> the expected one.

Thanks for the detailed explanation -- that makes sense.

I'm closing the bug report.  Sorry about the noise.

Thanks,
Stefan Kangas




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 02 Aug 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 262 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.