bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35418: [PATCH] Don't poll auto-revert files that use notification


From: Eli Zaretskii
Subject: bug#35418: [PATCH] Don't poll auto-revert files that use notification
Date: Wed, 24 Apr 2019 21:58:18 +0300

> From: Mattias Engdegård <mattiase@acm.org>
> Date: Wed, 24 Apr 2019 20:14:46 +0200
> Cc: Michael Albinus <michael.albinus@gmx.de>
> 
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]