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

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Wed, 24 Apr 2019 18:16:02 UTC

Severity: normal

Tags: patch

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 35418 <at> debbugs.gnu.org
Subject: bug#35418: [PATCH] Don't poll auto-revert files that use notification
Date: Mon, 29 Apr 2019 09:53:36 +0200
Mattias Engdegård <mattiase <at> acm.org> writes:

Hi Mattias,

> Here is an updated patch. There is a new variable,
> `auto-revert-always-poll', which is t by default.
> There is also a note in etc/NEWS. Does it merit a mention in the manual as well?

Yes, please.

> +(defcustom auto-revert-always-poll t
> +  "Non-nil to poll files even if notification is available.
> +
> +Set this variable to nil to save power by avoiding polling when
> +possible.  Files on file-systems that do not support file
> +notifications must match `auto-revert-notify-exclude-dir-regexp'
> +for Auto-Revert to work properly in this case.  This typically
> +includes network file systems on Unix-like machines, for files
> +that are modified from another computer.
> +
> +When non-nil, buffers in Auto-Revert Mode will always be polled
> +for changes to their files on disk every `auto-revert-interval'
> +seconds.
> +
> +In Global Auto-Revert Mode, polling is always done regardless of
> +the value of this variable."

I believe it shall be said, that this user option does not compete with
`auto-revert-use-notify'. Rather, polling is used additionally to file
notification. When `auto-revert-use-notify' is nil, the value of
`auto-revert-always-poll' doesn't matter; there will always be polling.

Saying this, the user option might need another name. What about
`auto-revert-also-poll'?

> +(defvar auto-revert--polled-buffers ()
> +  "List of buffers in Auto-Revert Mode that must be polled.
> +It contains the buffers in `auto-revert-buffer-list' whose
> +`auto-revert-notify-watch-descriptor' is nil.")

Is this variable needed? It is used only once in
`auto-revert--need-polling', and it could be computed easily by
(untested)

(delq nil
  (mapcar (lambda (buf)
            (and (or auto-revert-always-poll
                     (not auto-revert-notify-watch-descriptor))
                 buf))
          auto-revert-buffer-list))

`auto-revert--need-polling' shall always return the buffer list, also for
`global-auto-revert-mode'.

Otherwise, the patch might work. Let's try it.

Best regards, Michael.




This bug report was last modified 6 years and 4 days ago.

Previous Next


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