GNU bug report logs - #43412
[FEATURE] autorevert-only-if-visible [PATCH]

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Boruch Baum <boruch_baum@HIDDEN>; Keywords: patch; dated Tue, 15 Sep 2020 04:08:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 43412 <at> debbugs.gnu.org:


Received: (at 43412) by debbugs.gnu.org; 15 Sep 2020 16:12:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 12:12:52 2020
Received: from localhost ([127.0.0.1]:60397 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIDZb-0000XG-OV
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 12:12:51 -0400
Received: from mout.gmx.net ([212.227.17.22]:50881)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <boruch_baum@HIDDEN>) id 1kIDZZ-0000X1-0q
 for 43412 <at> debbugs.gnu.org; Tue, 15 Sep 2020 12:12:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1600186362;
 bh=kdd6STReBqGt+yp3k1NOR56lu+hMvX/4mwzpnDIxzEk=;
 h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To;
 b=j7tYvDGpy/eaTfaOB1SbGHixHK6Up+pRIxr3mUt0wYZlyI74owYa8kRz3Z4eX9EEG
 knIYZbqoH8upyoUIjFdJDZUJUfxhCM5GwFrtQP7NGgmLyjQmVj/4mhCXwx9zpnBlUQ
 tkgSZ/2m+R44KCn7y9ZPgVzgOt7XZ8Z9Q54mXwPU=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from E15-2016.optimum.net ([72.89.170.172]) by mail.gmx.com
 (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id
 1MfYPY-1kxu2U0W8e-00fz9v; Tue, 15 Sep 2020 18:12:42 +0200
Date: Tue, 15 Sep 2020 12:12:39 -0400
From: Boruch Baum <boruch_baum@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#43412: [FEATURE] autorevert-only-if-visible [PATCH]
Message-ID: <20200915161239.f3fb74daihpon64w@HIDDEN>
References: <20200915040728.77ufv7g6bekvrzqa@HIDDEN>
 <83y2lb8648.fsf@HIDDEN>
 <20200915153958.e2nry7dxl3pmu3k6@HIDDEN>
 <83imcf82fy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <83imcf82fy.fsf@HIDDEN>
User-Agent: NeoMutt/20180716
X-Provags-ID: V03:K1:jO/tGxk+ALC8g1YcieFRu6E2rlZEs7Anb92Ki2+bWZBv3WQFATn
 ZyjLpfnBOU6F0cdZgj5aHMGyrO9A8gbyOP7O/GkHCBBM9XDIG+/K6dkVFe0MmAAdTTG2bZK
 9t4SyTm8shLSfbHxw7SwkluAApKhgunRAjwIy03Q6/nT0k20yr1YSV3J546D2qS0c/ArNgn
 vpob+Wy7F0WDhwluPE8Xw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:akqwnl/IIbc=:+b9xr/M8wPoBdcnTyoLs4S
 YSOrrHIiPamRHi1bdh9przfNZOBL/rNKMXG40O9xKpCgygcj8jwaB7VSlI3YIbKsDdcrEJJsS
 1QdUUBbg/KdMxOWF/Wfw6Uwbw3FHn6xf6aQP7Wvi/wtNYccZwwSsT3Ia+ZyVs6z31VZJehRHk
 Q21rtbbETfXp7lQJT2fBv+WtedqhnnxUtJOYYWRxOgaCja0IVd5Ld2OmrrZoXhhGb1uL7+OW6
 buWNL+3iPIjLnPpwiYqNx38IwLWZRp0hGQn7EYDXZO6fsMQgvtVIDdc+PaA47ntg1M8r3Hjgl
 eeH06x82o2at2yeoPuFO54hw9xQU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u.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 2020-09-15 18:49, Eli Zaretskii wrote:
> > Date: Tue, 15 Sep 2020 11:39:58 -0400
> > From: Boruch Baum <boruch_baum@HIDDEN>
> > Cc: 43412 <at> debbugs.gnu.org
> >
> > > Btw, what will be the effect of this option?  Suppose some buffer wa=
s
> > > 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 a=
n
> > un-reverted buffer is displayed, it is in its 'stale' state but is als=
o
> > instantly considered for auto-revert.
>
> Maybe we should arrange it to actually auto-revert before being
> displayed.  I envision bug reports if we don't.

Do you have a strategy or implementation in mind? Would adding a
function to `window-configuration-change-hook' do the trick (ie. catch
all relevant events)?

=2D-
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43412; Package emacs. Full text available.

Message received at 43412 <at> debbugs.gnu.org:


Received: (at 43412) by debbugs.gnu.org; 15 Sep 2020 15:50:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 11:50:02 2020
Received: from localhost ([127.0.0.1]:60346 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIDDW-0006Da-Cj
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 11:50:02 -0400
Received: from eggs.gnu.org ([209.51.188.92]:44650)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kIDDV-0006D2-2r
 for 43412 <at> debbugs.gnu.org; Tue, 15 Sep 2020 11:50:01 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47909)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kIDDO-0006Yp-2k; Tue, 15 Sep 2020 11:49:54 -0400
Received: from [176.228.60.248] (port=2138 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kIDDH-0005wK-BT; Tue, 15 Sep 2020 11:49:48 -0400
Date: Tue, 15 Sep 2020 18:49:53 +0300
Message-Id: <83imcf82fy.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Boruch Baum <boruch_baum@HIDDEN>
In-Reply-To: <20200915153958.e2nry7dxl3pmu3k6@HIDDEN> (message
 from Boruch Baum on Tue, 15 Sep 2020 11:39:58 -0400)
Subject: Re: bug#43412: [FEATURE] autorevert-only-if-visible [PATCH]
References: <20200915040728.77ufv7g6bekvrzqa@HIDDEN>
 <83y2lb8648.fsf@HIDDEN>
 <20200915153958.e2nry7dxl3pmu3k6@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43412
Cc: 43412 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 15 Sep 2020 11:39:58 -0400
> From: Boruch Baum <boruch_baum@HIDDEN>
> Cc: 43412 <at> debbugs.gnu.org
> 
>   Off-topic: would anything constructive result if I submit a separate
>   'complaint' about that behavior / judgment / decision that 'Such
>   frames are always considered visible'?

That's why I said "visible" is ambiguous.  "Frame visibility" is a
concept in Emacs, so changing it now, and for TTY displays on top of
that, is next to unimaginable, IMO.

> > 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.

Maybe we should arrange it to actually auto-revert before being
displayed.  I envision bug reports if we don't.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43412; Package emacs. Full text available.

Message received at 43412 <at> debbugs.gnu.org:


Received: (at 43412) by debbugs.gnu.org; 15 Sep 2020 15:40:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 11:40:11 2020
Received: from localhost ([127.0.0.1]:60292 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kID3y-0003jK-Vg
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 11:40:11 -0400
Received: from mout.gmx.net ([212.227.17.21]:55847)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <boruch_baum@HIDDEN>) id 1kID3w-0003j3-OL
 for 43412 <at> 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
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
Date: Tue, 15 Sep 2020 11:39:58 -0400
From: Boruch Baum <boruch_baum@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#43412: [FEATURE] autorevert-only-if-visible [PATCH]
Message-ID: <20200915153958.e2nry7dxl3pmu3k6@HIDDEN>
References: <20200915040728.77ufv7g6bekvrzqa@HIDDEN>
 <83y2lb8648.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
In-Reply-To: <83y2lb8648.fsf@HIDD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npG7aaxZAE/LKxI
 sDEekQe/CIZDUM3Yi/X7IAcDcxs+65aWG/UxhV2Jq+zdS/xItx7g9QkxO0ArgEhKQB3Xde6zy
 q7BK2pcNnu1A6DEIhuX0TUA43ShDH9lnpeLELPOT3dP/rz6qN8XuOISSb1v8uUWuCb40k8+ts
 A1vk1dj/XMH4DzbcJv+1oZc0DTyJGSZpEHr6E7qyUFxFNJFlLDXahnu5dSbQZJLngUiUkz1GF
 ImBordoSHZZl0uqmxmvmHRIRgV3oBW+aVG/ieluQAMiNYeulQ5lvjrmFED3Fe1PUnSz3VRt5L
 xrZ4YH4FCbP7jhzSHKOBTtySv1J/5cFnsM2sQqReYWtHdsiumeSZwgfaYoKNgL0GzVNBlSFfB
 tnWGGQPi9QID+APayGozdQOXCH87lcev1rj/FUPNl66Kwp4qjYf9TsAZNxaKrDj19vk9h46ZU
 aa5IOwkEnjAHuHZ7n2ZTFhZLq11AsJdVVlesrBQkSDJiG5C6CUL9DK/18QeVfPsCnS7lAYzEN
 fvU1cBBX51SVCBC5LFYnHtaLnqgb7iJLmaiFtqw==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 43412
Cc: 43412 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

On 2020-09-15 17:30, Eli Zaretskii wrote:
> > Date: Tue, 15 Sep 2020 00:07:28 -0400
> > From: Boruch Baum <boruch_baum@HIDDEN>
> >
> > +(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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43412; Package emacs. Full text available.

Message received at 43412 <at> debbugs.gnu.org:


Received: (at 43412) by debbugs.gnu.org; 15 Sep 2020 14:30:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 10:30:45 2020
Received: from localhost ([127.0.0.1]:60076 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kIByn-0005ys-4d
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 10:30:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51072)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1kIByl-0005yf-Ak
 for 43412 <at> debbugs.gnu.org; Tue, 15 Sep 2020 10:30:43 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:46078)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <eliz@HIDDEN>)
 id 1kIByf-0002Bh-A6; Tue, 15 Sep 2020 10:30:37 -0400
Received: from [176.228.60.248] (port=1228 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1kIByV-0005Sg-Bj; Tue, 15 Sep 2020 10:30:35 -0400
Date: Tue, 15 Sep 2020 17:30:31 +0300
Message-Id: <83y2lb8648.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Boruch Baum <boruch_baum@HIDDEN>
In-Reply-To: <20200915040728.77ufv7g6bekvrzqa@HIDDEN> (message
 from Boruch Baum on Tue, 15 Sep 2020 00:07:28 -0400)
Subject: Re: bug#43412: [FEATURE] autorevert-only-if-visible [PATCH]
References: <20200915040728.77ufv7g6bekvrzqa@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 43412
Cc: 43412 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 15 Sep 2020 00:07:28 -0400
> From: Boruch Baum <boruch_baum@HIDDEN>
> 
> +(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).

> +  :version "28")
              ^^^^
"28.1"

> +                         (if (display-graphic-p) 'visible (window-normalize-frame nil)))))))

Is the different treatment of GUI and TTY frames necessary here?

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?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#43412; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Sep 2020 04:07:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 15 00:07:40 2020
Received: from localhost ([127.0.0.1]:56843 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kI2Fo-0003dP-FB
	for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 00:07:40 -0400
Received: from lists.gnu.org ([209.51.188.17]:54332)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <boruch_baum@HIDDEN>) id 1kI2Fl-0003dG-MN
 for submit <at> debbugs.gnu.org; Tue, 15 Sep 2020 00:07:38 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57526)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <boruch_baum@HIDDEN>)
 id 1kI2Fl-000448-Ff
 for bug-gnu-emacs@HIDDEN; Tue, 15 Sep 2020 00:07:37 -0400
Received: from mout.gmx.net ([212.227.17.22]:47345)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <boruch_baum@HIDDEN>)
 id 1kI2Fj-0005Dv-8F
 for bug-gnu-emacs@HIDDEN; Tue, 15 Sep 2020 00:07:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1600142852;
 bh=h7C1u/UJqrsh/YJgL2Ekk6h0NvqMGwscE6E0+0pNm/0=;
 h=X-UI-Sender-Class:Date:From:To:Subject;
 b=A3/QNmjvsLdqQYkq3eZD6dkOlgf8dSf2UlAUhj0/xBP1f/6CGL6yMoVC/usLHWG/L
 FuEfxkaNKT6q8ggw9n3H96XPX5imcJNOCO2uB4n9iNBZ7W9GGsXP4eyBwOfHwLi75T
 g6i5VM7jHXcxEDo2zqnSGj2zvVUdiCUrLmtwba2U=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from E15-2016.optimum.net ([72.89.170.172]) by mail.gmx.com
 (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id
 1MeCtj-1ktI4y2DI7-00bLKM for <bug-gnu-emacs@HIDDEN>; Tue, 15 Sep 2020
 06:07:31 +0200
Date: Tue, 15 Sep 2020 00:07:28 -0400
From: Boruch Baum <boruch_baum@HIDDEN>
To: Emacs Bug Reporting <bug-gnu-emacs@HIDDEN>
Subject: [FEATURE] autorevert-only-if-visible [PATCH]
Message-ID: <20200915040728.77ufv7g6bekvrzqa@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="c3dgevwv4k6pvmht"
Content-Disposition: inline
User-Agent: NeoMutt/20180716
X-Provags-ID: V03:K1:RBLT1cKDuXMPg4V9lJ8da97wxws9aKjxLbe/PD0Gdh4C5GFvp1X
 gxpZp1SUCTpZqs1/pwhz5k1pSWPiX33T1sBUOB47EhIedA45o837LUnyAJbizGq90HZmAGm
 VlSa/2x2+Yawl4wu1Omm9T320DbFk5WfqUYyr5TXKIFT7SUionlhrrKM6miXfyvfHXHh7cO
 3+nbCjqUbfabRr6gv2SPQ==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:/aeqbMjveZ8=:XdqreI/yFfZqghlfED0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/vHuUc6zhR80MgAlUhHYPOEhiZv2ifSWOKfmTCspRt+aXe5pbQaTPVw+12CJkQIkUM
 wxj7hHi6XXF+2/EDMV7jjVHZxjexam9I6gmXlkmc0YSp0Ua+smBpRbuwRI7/Roo/05D9Gkfba
 y1MyY6pKLcEJQKDTbkmhXEXa5Cfn0YqmqjW1sFH+L5b4pHlf6ut4lwdhXtNBW/pgHylgs4mj4
 4Ontpva3P4n7HVlpkKmTWDhWKH2vzBvtkcqSB0g==
Received-SPF: pass client-ip=212.227.17.22; envelope-from=boruch_baum@HIDDEN;
 helo=mout.gmx.net
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/15 00:07:32
X-ACL-Warn: Detected OS   = Linux 2.2.x-3.x [generic]
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.6 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)


--c3dgevwv4k6pvmht
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

The attached proposed patch adds a defcustom and makes a change to two
existing functions in order to allow a user the option to only have
autorevert mode operate on visible buffers. The change to function
'after-find-files' may also fix a bug (or change behavior) in that
sometimes when being prompted to manually revert a buffer that had been
in auto-revert-mode, the auto-revert-mode status would be lost, ie. set
to nil.

Use of this feature:

1) Reduces CPU workload when using autorevert

2) Reduces messages when using `auto-revert-verbose'

Possible disadvantage:

1) When making a buffer visible, it might take as long as
   'auto-revert-interval' seconds for any accumulated changes to
   auto-revert. The default for that value is five seconds.

=2D-
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0

--c3dgevwv4k6pvmht
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="autorevert.patch"
Content-Transfer-Encoding: quoted-printable

diff --git a/autorevert.el b/autorevert.el
index 7b83026..ace010e 100644
=2D-- a/autorevert.el
+++ b/autorevert.el
@@ -302,6 +302,12 @@ You should set this variable through Custom."
   :type 'regexp
   :version "24.4")

+(defcustom auto-revert-only-if-visible nil
+  "If non-nil, suppress Auto-Revert Mode when a buffer isn't visible."
+  :group 'auto-revert
+  :type 'boolean
+  :version "28")
+
 ;; Internal variables:

 (defvar auto-revert-buffer-list ()
@@ -686,8 +692,14 @@ This is an internal function used by Auto-Revert Mode=
."
                               #'buffer-stale--default-function)
                           t))))
          eob eoblist)
-    (setq auto-revert-notify-modified-p nil)
-    (when revert
+    (when (and revert
+               (or (not auto-revert-only-if-visible)
+                   (member buffer
+                     (mapcar 'window-buffer
+                       (get-buffer-window-list
+                         nil nil
+                         (if (display-graphic-p) 'visible (window-normali=
ze-frame nil)))))))
+      (setq auto-revert-notify-modified-p nil)
       (when (and auto-revert-verbose
                  (not (eq revert 'fast)))
         (message "Reverting buffer `%s'." (buffer-name)))

--c3dgevwv4k6pvmht
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="files.patch"

diff --git a/files.el b/files.el
index e6629d2..2cdf451 100644
--- a/files.el
+++ b/files.el
@@ -2570,7 +2570,10 @@ unless NOMODES is non-nil."
   (unless nomodes
     (when (and view-read-only view-mode)
       (view-mode -1))
-    (normal-mode t)
+    (let ((auto-revert auto-revert-mode))
+      (normal-mode t)
+      (when auto-revert
+        (auto-revert-mode 1)))
     ;; If requested, add a newline at the end of the file.
     (and (memq require-final-newline '(visit visit-save))
 	 (> (point-max) (point-min))

--c3dgevwv4k6pvmht
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="NEWS.patch"
Content-Transfer-Encoding: quoted-printable

diff --git a/NEWS b/NEWS
index 4076630..579f1f9 100644
=2D-- a/NEWS
+++ b/NEWS
@@ -1157,6 +1157,12 @@ type symbols.
 messages, contain the error name of that message now.  They can be
 made visible by setting user variable 'dbus-show-dbus-errors' to
 non-nil, even if protected by 'dbus-ignore-errors' otherwise.
+** Autorevert
+
++++
+*** autorevert can be restricted to act only when a buffer is visible
+
+Enable the feature using defcustom variable 'auto-revert-only-if-visible'=
.

 =0C
 * New Modes and Packages in Emacs 28.1

--c3dgevwv4k6pvmht--




Acknowledgement sent to Boruch Baum <boruch_baum@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#43412; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 15 Sep 2020 16:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.