From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#35418: [PATCH] Don't poll auto-revert files that use notification Date: Wed, 24 Apr 2019 21:58:18 +0300 Message-ID: <83sgu71b91.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="80552"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35418@debbugs.gnu.org, michael.albinus@gmx.de To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 24 21:14:56 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJNM8-000KqM-7I for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Apr 2019 21:14:56 +0200 Original-Received: from localhost ([127.0.0.1]:45990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJNM7-0008Ta-2T for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Apr 2019 15:14:55 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJN6m-0002k7-NM for bug-gnu-emacs@gnu.org; Wed, 24 Apr 2019 14:59:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJN6k-00053p-Ox for bug-gnu-emacs@gnu.org; Wed, 24 Apr 2019 14:59:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42969) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hJN6k-000539-EU for bug-gnu-emacs@gnu.org; Wed, 24 Apr 2019 14:59:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hJN6k-0003z4-C6 for bug-gnu-emacs@gnu.org; Wed, 24 Apr 2019 14:59:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Apr 2019 18:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35418 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35418-submit@debbugs.gnu.org id=B35418.155613231715273 (code B ref 35418); Wed, 24 Apr 2019 18:59:02 +0000 Original-Received: (at 35418) by debbugs.gnu.org; 24 Apr 2019 18:58:37 +0000 Original-Received: from localhost ([127.0.0.1]:56512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hJN6L-0003yG-A3 for submit@debbugs.gnu.org; Wed, 24 Apr 2019 14:58:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59655) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hJN6K-0003y4-FB for 35418@debbugs.gnu.org; Wed, 24 Apr 2019 14:58:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJN6E-0004NN-TI; Wed, 24 Apr 2019 14:58:30 -0400 Original-Received: from [176.228.60.248] (port=3591 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hJN6B-00072i-52; Wed, 24 Apr 2019 14:58:29 -0400 In-reply-to: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Wed, 24 Apr 2019 20:14:46 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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: 209.51.188.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:158197 Archived-At: > From: Mattias EngdegÄrd > Date: Wed, 24 Apr 2019 20:14:46 +0200 > Cc: Michael Albinus > > It is a waste of power, on battery-powered devices in particular, to poll files in auto-revert mode periodically when change notification is used. The change is straightforward (attached patch); the main concern is whether the notification system is reliable enough. The polling was added for a reason, and the reason was not reliability of the notifications. The reason is hinted upon in this comment: ;; If we have file notifications, we want to update the auto-revert buffers ;; immediately when a notification occurs. Since file updates can happen very ;; often, we want to skip some revert operations so that we don't spend all our ;; time reverting the buffer. ;; ;; We do this by reverting immediately in response to the first in a flurry of ;; notifications. We suppress subsequent notifications until the next time ;; `auto-revert-buffers' is called (this happens on a timer with a period set by ;; `auto-revert-interval'). If you look at bug reports and discussions around the time this comment was written, you will find the descriptions of the use cases that caused this design. AFAIR, the main problem was with inotify, not with w32notify. > In general, it probably is. There is a comment in w32notify.c about SMB-mounted file systems from Samba servers; while Samba does support notification nowadays, there are probably older systems still be deficient in that regard. However, isn't this what `auto-revert-notify-exclude-dir-regexp' is for? I'm not familiar with the way Emacs is used on Windows, but would adding something like > > (rx bos > (or "\\\\" "//") > (one-or-more (not (any "/:\\"))) > (any "/\\")) > > to `auto-revert-notify-exclude-dir-regexp' be a good start? If you imply that Samba drives can be identified by the syntax of the file name alone, then I don't think this is a valid assumption. A certain drive letter can be mapped to a Samba volume, and we can never know that by looking just at the file name. More generally, auto-revert-notify-exclude-dir-regexp is for any situation where a filesystem doesn't cause notifications. You will find caveats about such issues in the documentation of every notification system we support. Thanks.