From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Make window-list return windows for all frames Date: Mon, 19 Jun 2023 08:55:09 +0200 Message-ID: References: <83fs6sub2k.fsf@gnu.org> <83cz1wu4vw.fsf@gnu.org> <321af4c6c101bd5a1bd2@heytings.org> <83y1kjsnjh.fsf@gnu.org> <83o7leqy7s.fsf@gnu.org> <83cz1uqsix.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24391"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: martin rudalics , gregory@heytings.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 19 18:06:09 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qBHOK-00067T-RC for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Jun 2023 18:06:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBHNR-0001Ik-45; Mon, 19 Jun 2023 12:05:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qB8nI-0000OL-00 for emacs-devel@gnu.org; Mon, 19 Jun 2023 02:55:20 -0400 Original-Received: from mail-he1eur01olkn2016.outbound.protection.outlook.com ([40.92.65.16] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qB8nD-00039G-TB; Mon, 19 Jun 2023 02:55:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kgt1m0nPjbLefGLsPT8VSzRG0IM0hYeNwyDRPkR6ZifDPmYJ0kmGQonLqlsxAE8BhGbNvYDly7X7WCXyDfwn5fyEx8Oey1ZLgetF2+1RZJ/aorG4YFo5uujT4sG0Qy8YBEuTe+erFJ57VavFzNWgJG0LshuHokTQnfM/KTrbZXvjFEEHhUVBO/JGlFF0wsT6in97mKk0SOvJqX7LDrLm0OpbSCYl+L69vFuH8/N9biS9mTRG/P7kLz+XLADSOW6wq5ZFy2ViK1dtLr3yDX/XAyQvf9rrKsCtAyu3Ud0c4Xc1VfnCTX1WRqEOXDU+yAosknsqIt7GFXrIcM5KaMCkag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=99EaIdSf6AUSFVLm/srHcnTXHd79Q8y+iVPKzCprIJo=; b=EV6Le2AqLFIlV+N8Gcs7O8aMJrZWzGCXd+akijo8vVK4uub2iXLixcs9WNmIjyqrreW4dQdFFxKoOGgoq9mijIBOveOxTKa/LQtO/LHd7esdnkWkpguYUGnBDU5NeN/fo/QOT4XtHWT+jC6DhlzH1wEtCc4lB3qOSJ3BXbgj8J1px5/nxKlmp/LcdTS4mVPiRFzJpieItCaDk+rSLCC66O4Y7joFjCF37R+1tx05LeU1cKt6m+m8ZIE3DTB0bzhPbcHSshbq1rUkXsvRu2CIX+L8GUfmQNyoGRA1ZwYpj4pBBdxfzvUdEO6vPaXVMT1xacB6E9KO+gjbJP9uNq0n7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=99EaIdSf6AUSFVLm/srHcnTXHd79Q8y+iVPKzCprIJo=; b=nBbhIxmzP9MwLJc0b7Rdf+6V9+23CoP7h/zhsOUYzD0hwm9DXTsoRaVWirGa0phEt6XlM52xG0h2HqeD6HjUUdHfsHS7+1+xKASZjI1xr0ZiDLHD1dpU+g7kj7/V6jL0fEJDL/U2OvDjXwnzWWlTv5rjKRGCqvNgCuYDkgn2wgiazVewa+yj1ON8vJRFmvCQvuScUUWGgZzINzYbrDxyuo0xrWTEVFoA5y1W4YY/aEMRmUw1eNkTGhwC2V9c32tI5ZFVYllTxPcj7kzTg5u+bXpaEi8CW8cWdj8FwRxr5hAMYpbgdXqQbxVBrBH+PUIlnSR2MkdedLnT/uj8/44aTg== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB3794.eurprd09.prod.outlook.com (2603:10a6:208:181::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.36; Mon, 19 Jun 2023 06:55:11 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::4a5f:42f9:d78f:2021]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::4a5f:42f9:d78f:2021%4]) with mapi id 15.20.6500.036; Mon, 19 Jun 2023 06:55:11 +0000 In-Reply-To: <83cz1uqsix.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 17 Jun 2023 06:42:32 -0400") X-TMN: [rVaYLhVwxhpjTtaJ6aYoyDVBNlg6B3ZMyB/Aeh5W0MY=] X-ClientProxiedBy: BE1P281CA0417.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:83::18) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87h6r4q6uq.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR09MB4977:EE_|AM0PR09MB3794:EE_ X-MS-Office365-Filtering-Correlation-Id: e648a101-5cf4-4fc2-c19d-08db70921fcc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xz5OACwn4Ch2Gg/whphXRDkPalQ7IBdgQcHDhEBoIqjMlc1ZeuUize7xTnCKQHDq9884qHdcJuTNFy8vjf4zN3QZuwjcHp6VgThjI7xStArsFPtTL95QJYPbt3GGKDc4T4b/UqB51qoA3F/fGWWnsDhhpGdc6dDaOgLr9szN5AVbqaVOdY0pZrWKOI8hbjOEe3rDU0/tQNAzNr7P6z1ShNjKCEy79Ax+1OZiJiKuHsKsaFsrqXZGpRJrvnBOS0oNPeVqx10Q1meQxllaoQa2ve1I2O/1txxWDw0FMyyV1mPLJhSv4x9Y3Ejxo6BNfU2+AeQUfyF8+9nt/cF6eytSG6uBgxf02Iue8FxSLEaHLcrZGLH3nbpn/Gp2nMbKiGOxSPXnvIvjLWwiIhOzd1YgRu3MdBQw0j79+GjfJMPzC2o/PknhpoRY6uFdM5x4Y8BgaRvBPsxqzF6CMVhb9Yv4mtxU9i/Bbxg8OYttx0czsR5CiLkyKb/Aot9gRcWGJTaGTdxUXzsyfHUQBL69I6CpkZBBykMpa/oXcXjaJW+arQqCAIqFCbpt+6nCTNalaPXCxwZ7kHyXjBu5ytybEx5PoPgZBhdli3L2tr9nKmqfnGeFYe3Uv3sOkTa0nHmKaofP X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SeVsdheDmfnuhdMPgzoh1wl3fsXuHj4NG/WlnXFOXIKf6OFE9RRLk/exnQFL?= =?us-ascii?Q?/Gw0hjCQbreh96kFLCY0c5r2hINKo2UbgHPL/8zhLMhYJDBjxn2T404BXuWD?= =?us-ascii?Q?7TywwO7MKRAwh/YUPLsnljfQqRQAWS+s8ATUyvstTg4uYjzgw16SP10R5bO7?= =?us-ascii?Q?fOGQHjYQnhV8vuuZv86SbBVQDFboSDWQ5PyFJlMsjzZl809MadklWEbAlX0w?= =?us-ascii?Q?V/rdtEBLkoXJblI5ZxCq463nVI08jRk3jbCEobd74VpXpjXEdw/3RuNTU8fQ?= =?us-ascii?Q?R5N2bIqnhovJpUVYSajLRyFOMDYkZpRM/WmvRu6K4I6q6gQrAnx2MSu5wSG9?= =?us-ascii?Q?GG3sNwAGn8ygRiVqQAQA6HxmLyIguNu+YnhPWZk3xiRmAjAfuM3rIb5trCmh?= =?us-ascii?Q?343uGXtah7Aw1uQ5eNVFFPP/n1XlGT/WpBbLmTSVz+VAAEU2UQUQUK90Jxva?= =?us-ascii?Q?ISgk572Y8UouZe7cIbP+GetdPX/PuDIvkhgTGF67Etu7eyvvVHBk8iKVyeMO?= =?us-ascii?Q?kLKCrUSpbJ1EVSxX2mPHSR0yZ1glRyKr75yZlEKWAKfXI/+25aLs2b/ama6a?= =?us-ascii?Q?nCHdXIvRGX6rIu+rmoJ6V1rQUbktaJdcziuI3hRcteTM1YkbDo8UjvIjl9Zw?= =?us-ascii?Q?Z7 X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: e648a101-5cf4-4fc2-c19d-08db70921fcc X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2023 06:55:11.2741 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB3794 Received-SPF: pass client-ip=40.92.65.16; envelope-from=arthur.miller@live.com; helo=EUR01-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 19 Jun 2023 12:05:04 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:307048 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Date: Sat, 17 Jun 2023 11:39:43 +0200 >> Cc: arthur.miller@live.com, gregory@heytings.org, emacs-devel@gnu.org >> From: martin rudalics >> >> > Thanks. then I guess we can install (on master) the patch which makes >> > window-list accept t as the FRAME argument. >> >> I haven't seen the patch but I suppose that all it has to do is to skip >> the >> >> if (!EQ (frame, XWINDOW (window)->frame)) >> error ("Window is on a different frame"); >> >> check when FRAME is not a live frame. > > That, and a suitable change to the doc string, yes. Hello, can you please see if this is a suitable change? I seem to have done one extra empty line cleanup this time; is that OK or are there supposed to be two empty lines? A side question (for anyone): When runing ert in my normal Emacs with my configuration, I get this (top of) stack trace: (debugger-make-xrefs) (let ((debugger-previous-backtrace nil)) (debugger-make-xrefs)) (save-restriction (narrow-to-region begin (point)) (let ((debugger-previous-backtrace nil)) (debugger-make-xrefs))) (save-excursion (save-restriction (narrow-to-region begin (point)) (let ((debugger-previous-backtrace nil)) (debugger-make-xrefs)))) ert--make-xrefs-region(175 216) .... But when I run ert in emacs -Q, it works fine, so it is obviously something in my setup. Where to look for what is wrong, any advice on top of the head? Why would xref be involved here? Any idea? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-t-for-FRAME-in-window-list.patch >From 2277a0e80a89b5f34812e2c8e781bd3a7c81c392 Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Mon, 19 Jun 2023 08:52:23 +0200 Subject: [PATCH] Allow t for FRAME in window-list * src/window.c (window-list): Let window-list pass t as FRAME parameter further to window_list_1. * test/src/window-tests.el: New file. * test/src/window-tests.el (window-tests-window-list): Few tests to test that 't for all-frames works as in window-list-1. --- src/window.c | 3 ++- test/src/window-tests.el | 45 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 test/src/window-tests.el diff --git a/src/window.c b/src/window.c index f4e09f49eae..87a80cacadc 100644 --- a/src/window.c +++ b/src/window.c @@ -2992,6 +2992,7 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, doc: /* Return a list of windows on FRAME, starting with WINDOW. FRAME nil or omitted means use the selected frame. +FRAME t means consider all windows on all existing frames. WINDOW nil or omitted means use the window selected within FRAME. MINIBUF t means include the minibuffer window, even if it isn't active. MINIBUF nil or omitted means include the minibuffer window only @@ -3005,7 +3006,7 @@ DEFUN ("window-list", Fwindow_list, Swindow_list, 0, 3, 0, if (NILP (frame)) frame = selected_frame; - if (!EQ (frame, XWINDOW (window)->frame)) + if (!EQ (frame, XWINDOW (window)->frame) && !(BASE_EQ (frame, Qt))) error ("Window is on a different frame"); return window_list_1 (window, minibuf, frame); diff --git a/test/src/window-tests.el b/test/src/window-tests.el new file mode 100644 index 00000000000..b062318dd25 --- /dev/null +++ b/test/src/window-tests.el @@ -0,0 +1,45 @@ +;;; window-tests.el --- Tests for src/window.c -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Arthur Miller + +;; Author: Arthur Miller +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'ert) + +(ert-deftest window-tests-window-list () + (let ((windows-orig (window-list-1 nil nil t)) + (test-frame (make-frame '(visibility . nil)))) + (with-selected-frame test-frame + (split-window-right) + (should (= (length (window-list)) 2)) + (should (= (length (window-list t)) + (+ (length windows-orig) 2))) + (should (= (length (window-list)) + (length (window-list-1 + nil nil (selected-frame))))) + (should (= (length (window-list t)) + (length (window-list-1 nil nil t)))) + (delete-frame)))) + +(provide 'window-tests) +;;; window-tests.el ends here -- 2.41.0 --=-=-=--