From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#43412: [FEATURE] autorevert-only-if-visible [PATCH] Date: Tue, 15 Sep 2020 11:39:58 -0400 Message-ID: <20200915153958.e2nry7dxl3pmu3k6@E15-2016.optimum.net> References: <20200915040728.77ufv7g6bekvrzqa@E15-2016.optimum.net> <83y2lb8648.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="1285"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20180716 Cc: 43412@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 15 17:44:49 2020 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 1kID8T-0000Cl-HC for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Sep 2020 17:44:49 +0200 Original-Received: from localhost ([::1]:34386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kID8S-0003bK-Aj for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Sep 2020 11:44:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kID4o-0007eW-4b for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2020 11:41:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kID4n-0004uL-OH for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2020 11:41:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kID4n-0003l3-Jk for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2020 11:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Sep 2020 15:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43412 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 43412-submit@debbugs.gnu.org id=B43412.160018441114346 (code B ref 43412); Tue, 15 Sep 2020 15:41:01 +0000 Original-Received: (at 43412) by debbugs.gnu.org; 15 Sep 2020 15:40:11 +0000 Original-Received: from localhost ([127.0.0.1]:60292 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kID3y-0003jK-Vg for submit@debbugs.gnu.org; Tue, 15 Sep 2020 11:40:11 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:55847) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kID3w-0003j3-OL for 43412@debbugs.gnu.org; Tue, 15 Sep 2020 11:40:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1600184402; bh=3+uXRWuJWawr9RkjIqN9d9hGcuNFxgk1m9FEalx6cow=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=NKh37AmcpqagYZXfsmytBjjvaShWUMXIXYWqP5g5mcmsPw0SjWOvvjip5/tL/hgYG i7BA+Eg12+zV2R2lDsnaKHL0xkepXgjk9TQWx1U2Jisnlk2aVGoavdY4q19+sd09/1 +xk4S//0bFGlKT1v3Ac5d+rBSsUHsuJdh2b8k+Po= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from E15-2016.optimum.net ([72.89.170.172]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MKbkC-1k3r2b2JKu-00L0c0; Tue, 15 Sep 2020 17:40:01 +0200 Content-Disposition: inline In-Reply-To: <83y2lb8648.fsf@gnu.org> X-Provags-ID: V03:K1:8JVunSH8lXCS3mmHvzwvwWKHzGIHUlclyLO6Om4/owjdGHTqj/a W5+mn4BOBNo45cY24wTzF4+sQPxKpM7/H3iHoGsvXRYSEa3qHp88RtxpXZjX80QWK2K2vkV aHyXSNpD2WK33zKKHrJ0claBMQozR3y+kC32ZBQ92osBP8OZxLIJGPARv5D1nNNmvtMjb+r gSivx1Wy8KJOO8tNz+0rQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:mW2Y/kXXtkA=:LAUqQbIR+TwWie9Ilcae11 WQdMOxpmh5ofXwwqq6EfJlD1/x/RGrpWfzxdCtUEujLqYOmrYbpju/DamK+F7RWiHlridRPeA gyqF9dqeBzR6rfQOEcWFS6ztdhWIyI/gmhOyJeJeK1nA379tsuDfbMkYlzdCD1OQqndx11ZGO LcPDdVB9DcuNLtg/elsa9P9RGsSXbhR7AiCWOz7ofb7Bm2sUMO9V16+acBFeBoEUdLWL1b+xx 7fhnwnjuvA9kLm9PXvl1chs7iJnQbPGrNlvQR/qdVuTve2QwcQiPUGHJs0Fe/PQE16Tj3IELM eSs6S5ohv/wYWn/MjGgGo7d6O2lmR34NsuN8tKChCHTHTCEmqwECDXjfsx3NJXPBk7xviR+Z2 fKqPf0ct100tk2OlkfjFHxS7wlMhXvp+P//xrqr3pyfxt57oBtnNYKAUled8yvqpZxOEslV7a A7f0mggm0SSyU91g+Jrxn7XFEUMKuRmNaQqBLgiC6tGLYMWkBmugegUX/PkwfvbwsrjGc3VcP IyomoB99Hm8l5MN2f3ftCjHb9lfHoYb9xMbsRbLKtc2irAmSJjtwV0vW4Xqe6JzSbO7zaYleb Y3wvICUeLu0Swn8f7R1QfYc+hwLsGKsDj6TYxE10p3UF+R67Rh4DvGMIJdLw9265izuPj9L9/ zvvI4/CPBfIZT9ItyFvy/YpIG0CUzSxu5Glq1PW64Vy/5HVMUBZPmB81B0npG7aaxZAE/LKxI sDEekQe/CIZDUM3Yi/X7IAcDcxs+65aWG/UxhV2Jq+zdS/xItx7g9QkxO0ArgEhKQB3Xde6z 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:188130 Archived-At: On 2020-09-15 17:30, Eli Zaretskii wrote: > > Date: Tue, 15 Sep 2020 00:07:28 -0400 > > From: Boruch Baum > > > > +(defcustom auto-revert-only-if-visible nil > > + "If non-nil, suppress Auto-Revert Mode when a buffer isn't visible.= " > > "Visible" is ambiguous in this context. I suggest "not displayed in > any window" instead. Or, better, just "auto-revert only if buffer is > displayed" (which also solved a problem with double negation). In the case of TTY emacs, only one frame seems possible to ever be visible, but each and every frame seems to be considered, let's say 'displayed'. In that situation, this patch only auto-reverts buffers displayed on windows of the actually 'displayed' TTY frame. > > + :version "28") > ^^^^ > "28.1" Thanks. I had just taken a guess. > > + (if (display-graphic-p) 'visible (window-nor= malize-frame nil))))))) > > Is the different treatment of GUI and TTY frames necessary here? For users of TTY emacs (ahem, me), most assuredly. In TTY emacs, AFAICT only one frame can ever be 'displayed' (actually visible), but function `get-buffer-window-list' with argument ALL-FRAMES set to 'visible returns all windows on all frames. From that function's docstring: --8<--cut here-(start)------------------------------------------- >8 - =E2=80=98visible=E2=80=99 means consider all windows on all visible fr= ames on the current terminal. --8<--cut here-(end)--------------------------------------------- >8 That behavior of function `get-buffer-window-list' may in turn be because of the behavior of function `frame-visible-p', whose docstring begins with: --8<--cut here-(start)------------------------------------------- >8 Return t if FRAME is "visible" (actually in use for display). --8<--cut here-(end)--------------------------------------------- >8 But ends with the punch-line: --8<--cut here-(start)------------------------------------------- >8 If FRAME is a text terminal frame, this always returns t. Such frames are always considered visible, whether or not they are currently being displayed on the terminal. --8<--cut here-(end)--------------------------------------------- >8 So since for the purposes of this patch, what matters is the actual user experience, the distinction *was* needed. Off-topic: would anything constructive result if I submit a separate 'complaint' about that behavior / judgment / decision that 'Such frames are always considered visible'? > Btw, what will be the effect of this option? Suppose some buffer was > not displayed and missed its auto-revert opportunity. Then I switch > to it in some window -- will it appear with stale contents, or will it > auto-revert before being displayed in the window? I kind of mentioned this in my note: From my testing, at the instant an un-reverted buffer is displayed, it is in its 'stale' state but is also instantly considered for auto-revert. The *theoretical* maximum delay to the auto-revert then being performed is based upon defcustom `auto-revert-interval', whose default is five seconds. In practice, the possible downsides are that: 1) it might be visually surprising to the user to see the auto-revert occur; 2) if the user was very hurried to type at wherever POINT was in the buffer, then the auto-revert would be further delayed if defcustom `auto-revert-stop-on-user-input' was non-nil (the default), and would only happen once the hurried typist pauses. In my anecdotal use / testing / debugging, this has only every happened when I consciously made the effort to race the auto-revert, but the experience of a caffeinated or adrenaline-d user might be different. =2D- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0