From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#52380: ERT, buffers and windows Date: Fri, 10 Dec 2021 21:58:16 +0100 Message-ID: <871r2k9nyv.fsf@gmail.com> References: <87pmq666cb.fsf@gmail.com> <874k7gzmto.fsf@gnus.org> <87y24sy863.fsf@gnus.org> <87a6h89s7p.fsf@gmail.com> <875yrw9q85.fsf_-_@gmail.com> <831r2krymd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40329"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: larsi@gnus.org, 52380@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 10 21:59:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvmz3-000AHh-Nm for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Dec 2021 21:59:13 +0100 Original-Received: from localhost ([::1]:58924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvmz2-00068W-3R for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 10 Dec 2021 15:59:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvmys-000689-Kr for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2021 15:59:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36468) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mvmys-0005pP-CO for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2021 15:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mvmys-0003Zt-C6 for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2021 15:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Dec 2021 20:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52380 X-GNU-PR-Package: emacs Original-Received: via spool by 52380-submit@debbugs.gnu.org id=B52380.163916990813714 (code B ref 52380); Fri, 10 Dec 2021 20:59:02 +0000 Original-Received: (at 52380) by debbugs.gnu.org; 10 Dec 2021 20:58:28 +0000 Original-Received: from localhost ([127.0.0.1]:48014 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mvmyK-0003Z8-GH for submit@debbugs.gnu.org; Fri, 10 Dec 2021 15:58:28 -0500 Original-Received: from mail-wr1-f52.google.com ([209.85.221.52]:46007) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mvmyG-0003Yr-MS for 52380@debbugs.gnu.org; Fri, 10 Dec 2021 15:58:27 -0500 Original-Received: by mail-wr1-f52.google.com with SMTP id o13so16949970wrs.12 for <52380@debbugs.gnu.org>; Fri, 10 Dec 2021 12:58:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=7/uwLViLKrRoZjLsjzDiXwjMjzMAGjkmULUyUkphH3c=; b=Bdvasq6zoHQaW1T2Rhk+AS8NZYce1m79ncvuJR6G72o+/q7nw2ggGsozJAELnzzXF7 WuE/1b4QwNHRc2M9trctLcSPWfKkpuzW5383+h5FLbMFLh2bK47pk544IvW8Iyqn8a8y FUbBTkV6ZvA4IM8pYay2d0Vc+UUCiNXvAfLA9IhzAQ5uhyIzWvGTk9tBpSwyPoxhE8hL DyByMNQCSUkAudBqInVNEG0mFkjwIKIkW1y4ZAt/XdlVfRZbI29Pt4c8MOACg4bqwC5I mTwl4SL5gUZ6hmjdVL7S1LpiUxmoFxGLaSq85SEYXjI3aFZ4Asch3ihdnWYgJknaNTha 1+ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=7/uwLViLKrRoZjLsjzDiXwjMjzMAGjkmULUyUkphH3c=; b=bc64ImteP/JP69bYQjCI9ESn12ZmBAxsHSvKzqWQhOhGADhYyxzkYCyUd2bEBAPatm 3CpNxOjheXkWY7/IAWtwaXdVj9Ghr7TmzHzdiHe9of6TyBZ2G0urCiuidwCQHX1MWTxI RoAx4pbZUzxQ8GmJFpdM0BufiZEtfD917gDSlgCwUgoUI8L0U12U1b6hd92751TnYBef 1EHuN7l5xa2YfUg32v8GC7lsLbcGBkc9hhKQa0Y7lqDqFypfIakywgHW9/G3eG4CWBuj kjdtJu3YWSPsOfa9FuT6DE/CcR0QSUl5aKVoZ7NmSMRXoaJdIrTNmC6u91rT+1CeeN92 lL6w== X-Gm-Message-State: AOAM531hEC4Sv+Ue2LZzs6BE7pzPExwEDLchGlmR/gi220dOBxV+Nqir 3Q91A7Fm62u0T5FIl6491khCYA3NH4w= X-Google-Smtp-Source: ABdhPJwu5W/U5XdzIO9WOMKgmRdt4Uip1KnNwbciemI0/xbgFRewPc5M0I3UFZ/F9xeIGiRewpsSwg== X-Received: by 2002:adf:8165:: with SMTP id 92mr17604319wrm.199.1639169898595; Fri, 10 Dec 2021 12:58:18 -0800 (PST) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id u23sm3674653wru.21.2021.12.10.12.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 12:58:18 -0800 (PST) In-Reply-To: <831r2krymd.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 10 Dec 2021 22:30:50 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:222094 Archived-At: Eli Zaretskii writes: >> From: K=C3=A9vin Le Gouguec >> Date: Fri, 10 Dec 2021 21:09:30 +0100 >> Cc: 52380@debbugs.gnu.org >>=20 >> If I amend the test as follows: >>=20 >> diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/p= ython-tests.el >> index 15bda5c197..783f115fc7 100644 >> --- a/test/lisp/progmodes/python-tests.el >> +++ b/test/lisp/progmodes/python-tests.el >> @@ -5454,6 +5454,7 @@ python-tests--bug31398 >> "Test for https://debbugs.gnu.org/31398 ." >> (skip-unless (executable-find python-tests-shell-interpreter)) >> (let ((buffer (process-buffer (run-python nil nil 'show)))) >> + (should (eq (get-buffer-window buffer) (selected-window))) >> (should (eq buffer (current-buffer))) >> (pop-to-buffer (other-buffer)) >> (run-python nil nil 'show) >>=20 >> =E2=80=A6 then (should (eq (get-buffer-window buffer) (selected-window))) >> passes, but (should (eq buffer (current-buffer))) does not. Does that >> make sense to anyone? > > You assume that the selected window always shows the current buffer? > That's not in general true. Mmm, thanks. I see that "(elisp) Current Buffer" has things to say on the subject: > When an editing command returns to the editor command loop, Emacs > automatically calls =E2=80=98set-buffer=E2=80=99 on the buffer shown in t= he selected > window (*note Selecting Windows::). In the context of ERT, what would be the correct way to test that after calling M-x run-python (=E2=89=A1 (run-python nil nil 'show)), the *Python* buffer is visible, and its window is selected? Should we just disregard (current-buffer) when writing ERT tests, and assert things in terms of (selected-window)? Or is there a way to make ERT "return to the editor command loop", thereby selecting the buffer shown in the selected window?