all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: 36497@debbugs.gnu.org
Subject: bug#36497: pop-to-buffer + quit-window negates with-current-buffer
Date: Thu, 4 Jul 2019 14:22:28 +0200	[thread overview]
Message-ID: <CADwFkmn4fLhGind=ejWZHYkW+yR4Ov11mRVi8j=MxFyPJt8vxA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

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

[-- Attachment #2: with-current-buffer-test.diff --]
[-- Type: application/octet-stream, Size: 585 bytes --]

diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 06db8f5c90..aa04d84dc3 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -400,5 +400,12 @@ subr-tests-add-hook-depth
   (should (equal subr-tests--hook '(f5 f10 f9 f6 f2 f1 f4 f3 f7 f8)))
   )
 
+(ert-deftest ert-tests-with-current-buffer/bug-XXXXX ()
+  (let ((buf (get-buffer-create "foo")))
+    (with-current-buffer buf
+      (pop-to-buffer (get-buffer-create "bar"))
+      (quit-window)
+      (should (equal (current-buffer) buf)))))
+
 (provide 'subr-tests)
 ;;; subr-tests.el ends here

             reply	other threads:[~2019-07-04 12:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-04 12:22 Stefan Kangas [this message]
2019-07-04 12:50 ` bug#36497: pop-to-buffer + quit-window negates with-current-buffer martin rudalics
2019-07-04 19:33   ` Stefan Kangas

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkmn4fLhGind=ejWZHYkW+yR4Ov11mRVi8j=MxFyPJt8vxA@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=36497@debbugs.gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.