From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.bugs Subject: bug#30207: 27.0.50; [PATCH] other-window-for-scrolling returns window on daemon frame Date: Mon, 22 Jan 2018 15:57:17 +0000 Message-ID: <87inbtvqci.fsf@tcd.ie> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1516636603 26567 195.159.176.226 (22 Jan 2018 15:56:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 Jan 2018 15:56:43 +0000 (UTC) To: 30207@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 22 16:56:39 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edeSF-0005LC-L4 for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Jan 2018 16:56:15 +0100 Original-Received: from localhost ([::1]:49664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edeUE-00056Q-Fo for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Jan 2018 10:58:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40224) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edeU2-00054I-JW for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2018 10:58:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edeTz-00006d-Fc for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2018 10:58:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58656) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1edeTz-00006U-9q for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2018 10:58:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1edeTz-0008OH-0k for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2018 10:58:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jan 2018 15:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 30207 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.151663665532189 (code B ref -1); Mon, 22 Jan 2018 15:58:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jan 2018 15:57:35 +0000 Original-Received: from localhost ([127.0.0.1]:38320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edeTX-0008N6-DT for submit@debbugs.gnu.org; Mon, 22 Jan 2018 10:57:35 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:49079) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edeTV-0008Mr-Jb for submit@debbugs.gnu.org; Mon, 22 Jan 2018 10:57:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edeTP-0008GL-66 for submit@debbugs.gnu.org; Mon, 22 Jan 2018 10:57:28 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45327) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1edeTP-0008GH-1X for submit@debbugs.gnu.org; Mon, 22 Jan 2018 10:57:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edeTN-0004fl-Gz for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2018 10:57:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edeTK-0008En-C9 for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2018 10:57:25 -0500 Original-Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:44356) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1edeTJ-0008E9-W2 for bug-gnu-emacs@gnu.org; Mon, 22 Jan 2018 10:57:22 -0500 Original-Received: by mail-wm0-x229.google.com with SMTP id t74so17347899wme.3 for ; Mon, 22 Jan 2018 07:57:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version; bh=87b+WHMRGP8wVYiTm36EB0RZB7z7Hd/WDzBnzY7U+5Q=; b=Tn14o3WuOS/UZQe15+wj+EmTVWX94w3uNtkoW7uLKfraKjbx/T8WnjCnm/WpPloC2D i1+aX7g9C9zLY1SpEGsTVkrnAsV4gP6WwVLUDZKmy+2qpBoW6Vy4eEfSspZdyIV1diuY hhR+nrrWyuzKItgi/vEsUGNbyC3lJg0wU8WmGfF0zypKlP8ECt2zpbt07kxZTvpGb5Rl K9xwJfWdK5yxWCT/ATXU7T7gbK92BHNPSufV5SvGVIbbToNskdKtPgrqpCGDsuQezkFC en4Xqte7B9LXujYSTIULDOPKBBtudklVYRS1pt5sf4K+KXh4eJoRCC7Kn7AiSwq54qog /MSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=87b+WHMRGP8wVYiTm36EB0RZB7z7Hd/WDzBnzY7U+5Q=; b=h7nELBkUtZmSIsWqFerFfHO+SoRlZwY67rpHNcNGAi4Wi/WnET7YuqPS7yw6odpWTZ IM8Glk247scW6ylxkDKIkarJciruBvVL8xekTQuHU+nOWAXFpXzN3bZA+HhIn3wVmtQZ 45phxkbsx2Dd+cvFAlZekV/b8YfWxBY8/5TkgplHXJjNM27jKRFGe0o0hZ1lLRLOqUOx Vi8EmKQh9VA68God6Toi3qdDPGJZ84I9m6EjMKJwM4zDPLILvAdDtrcyF6Riq4ZaqrT6 Ae10mNAsiCNxfLtM44ulo8x3EYu4tZ9eItr1+7vc89TNL0+xTJromgoMs4CL7UFEVTsy jWOg== X-Gm-Message-State: AKwxytfkf9sZtOxk4wgVaHQmbafbXa22ySE8P8m/ssQ4CWOtcUZ4MgJ6 izz5t3HeF6gbQIaJErR1j1W6YYKy X-Google-Smtp-Source: AH8x227wvOVDDgaB+w/r3RN04m9eXQwAIlb6AKQElLQ/lDVyEmWQtH4iNv3y0MIvw6DLxphWngkPKA== X-Received: by 10.80.149.216 with SMTP id x24mr14402219eda.74.1516636639716; Mon, 22 Jan 2018 07:57:19 -0800 (PST) Original-Received: from localhost ([213.233.148.32]) by smtp.gmail.com with ESMTPSA id z12sm5486177edm.0.2018.01.22.07.57.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Jan 2018 07:57:18 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:142378 Archived-At: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Do-not-scroll-other-window-in-daemon-frame.patch >From 0471afc8da07d2dc397f2cf833d9f8bccfbe31c1 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Mon, 22 Jan 2018 02:57:08 +0000 Subject: [PATCH] Do not scroll other window in daemon frame * src/window.c (Fother_window_for_scrolling): Ignore daemon frame when searching other frames for a window. --- src/window.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/window.c b/src/window.c index 08c3f32dff..c050b4e6c9 100644 --- a/src/window.c +++ b/src/window.c @@ -5704,6 +5704,7 @@ specifies the window. This takes precedence over (void) { Lisp_Object window; + struct frame *f; if (MINI_WINDOW_P (XWINDOW (selected_window)) && !NILP (Vminibuf_scroll_window)) @@ -5725,11 +5726,14 @@ specifies the window. This takes precedence over if (EQ (window, selected_window)) /* That didn't get us anywhere; look for a window on another - visible frame. */ + visible frame, ignoring the daemon's frame. */ do - window = Fnext_window (window, Qnil, Qt); - while (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (window)))) - && ! EQ (window, selected_window)); + { + window = Fnext_window (window, Qnil, Qt); + f = WINDOW_XFRAME (XWINDOW (window)); + } + while (! ((FRAME_VISIBLE_P (f) && ! (IS_DAEMON && FRAME_INITIAL_P (f))) + || EQ (window, selected_window))); } CHECK_LIVE_WINDOW (window); -- 2.15.1 --=-=-= Content-Type: text/plain Consider the following: 1. emacs -Q --daemon 2. emacsclient --create-frame 3. (selected-window) => # 4. (other-window-for-scrolling) => # 5. (frame-terminal (window-frame (other-window-for-scrolling))) => # This can result in commands scroll-other-window and scroll-other-window-down scrolling the "phantom" initial frame of the daemon instead of signalling a "no other window" error. I imagine this behaviour is never desirable. I believe this issue and its potential resolution share some ground with bug#27210 in that the daemon frame is counterintuitively considered visible in the following repeat-until condition in Fother_window_for_scrolling: do window = Fnext_window (window, Qnil, Qt); while (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (window)))) && ! EQ (window, selected_window)); Until a more thorough review of the visibility of the initial daemon frame is reached, I propose the attached patch to additionally ignore the daemon frame in the aforementioned repeat-until condition. I assume the overhead of the additional loop logic and IS_DAEMON invariant is negligible compared to the rest of the function. An alternative approach to the attached patch would be to limit "other window scrolling" to frames in the current terminal, as per the spirit of bug#5616: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=diff.diff diff --git a/src/window.c b/src/window.c index 08c3f32dff..328fcb3829 100644 --- a/src/window.c +++ b/src/window.c @@ -5725,11 +5725,8 @@ specifies the window. This takes precedence over if (EQ (window, selected_window)) /* That didn't get us anywhere; look for a window on another - visible frame. */ - do - window = Fnext_window (window, Qnil, Qt); - while (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (window)))) - && ! EQ (window, selected_window)); + visible frame on the current terminal. */ + window = Fnext_window (window, Qnil, Qvisible); } CHECK_LIVE_WINDOW (window); --=-=-= Content-Type: text/plain or at least prioritise the current terminal's frames. WDYT? Thanks, -- Basil In GNU Emacs 27.0.50 (build 25, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2018-01-22 built on thunk Repository revision: c42959cc206bcb52baffd45f892da1b767f0f8c1 Windowing system distributor 'The X.Org Foundation', version 11.0.11905000 System Description: Debian GNU/Linux testing (buster) Configured using: 'configure --config-cache --prefix=/home/blc/.local --with-mailutils --with-x-toolkit=lucid --with-modules --with-file-notification=yes --with-x 'CFLAGS=-flto -fomit-frame-pointer -march=native -maes -mavx -mcrc32 -mf16c -mfpmath=sse -mfsgsbase -mfxsr -minline-all-stringops -mmmx -mpclmul -mpopcnt -msahf -msse4.2 -mxsave -mxsaveopt -mvzeroupper -O2 -pipe' LDFLAGS=-flto' Configured features: XAW3D XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 MODULES THREADS LIBSYSTEMD JSON LCMS2 --=-=-=--