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.

Full log


View this message in rfc822 format

From: martin rudalics <rudalics <at> gmx.at>
To: Stefan Kangas <stefan <at> marxist.se>, 36497 <at> debbugs.gnu.org
Subject: 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




This bug report was last modified 5 years and 317 days ago.

Previous Next


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