From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#35418: [PATCH] Don't poll auto-revert files that use notification Date: Sun, 28 Apr 2019 12:21:32 +0200 Message-ID: <86EFE367-90FF-4786-BC91-FC28FAF38A4E@acm.org> References: <83sgu71b91.fsf@gnu.org> <74CB5185-5DA1-4786-BD9C-9EEB3D43B3C1@acm.org> <83o94uz9h2.fsf@gnu.org> <875zqzssql.fsf@gmx.de> <83d0l7v193.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_32376299-BAC3-4AE7-8999-FEEE64A7B2B4" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="140291"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Michael Albinus , 35418@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 28 12:22:13 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 1hKgwl-000aLd-PP for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Apr 2019 12:22:12 +0200 Original-Received: from localhost ([127.0.0.1]:42245 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKgwk-0005Iu-QN for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Apr 2019 06:22:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKgwd-0005Ib-3J for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2019 06:22:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hKgwc-0007U3-81 for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2019 06:22:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51471) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hKgwc-0007Tx-3i for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2019 06:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hKgwb-0000dj-UL for bug-gnu-emacs@gnu.org; Sun, 28 Apr 2019 06:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Apr 2019 10:22:01 +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.15564469002432 (code B ref 35418); Sun, 28 Apr 2019 10:22:01 +0000 Original-Received: (at 35418) by debbugs.gnu.org; 28 Apr 2019 10:21:40 +0000 Original-Received: from localhost ([127.0.0.1]:36782 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKgwG-0000d9-IF for submit@debbugs.gnu.org; Sun, 28 Apr 2019 06:21:40 -0400 Original-Received: from mail238c50.megamailservers.eu ([91.136.10.248]:35806 helo=mail56c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hKgwC-0000cw-RP for 35418@debbugs.gnu.org; Sun, 28 Apr 2019 06:21:38 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1556446895; bh=U0fXqzpuaZn3cPcXbnRyBPJ9J77WfuqgC9xEMfz54l0=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=IdhQpAf24k4wN/DUc+uO+mqVpN6QKKjE4A1q1wT9xh6vfAW6bcNdi0xPPWC1BAh+K 2XtQf/sU/p+nNxTig57jYrsSADg6bb8N4iyCRXq4uaijAfpPuIkOa6QnIVrxjxM+gZ /5Y8MaO6qoe0MA7V2pmeEjbHjza4rLeNwzwH2OaU= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.1.64] (c-e636e253.032-75-73746f71.bbcust.telenor.se [83.226.54.230]) (authenticated bits=0) by mail56c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x3SALWSg010549; Sun, 28 Apr 2019 10:21:34 +0000 In-Reply-To: <83d0l7v193.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.8) X-CTCH-RefID: str=0001.0A0B0214.5CC57EAF.0016, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Y+fWTCWN c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=mDV3o1hIAAAA:8 a=gS5QxAW_RoBqbYhW_lYA:9 a=CjuIK1q_8ugA:10 a=0HWlrovhfOKs-LZF6vcA:9 a=B2y7HmGcmWMA:10 a=_FVE-zBwftR9WsbkzFJk:22 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:158390 Archived-At: --Apple-Mail=_32376299-BAC3-4AE7-8999-FEEE64A7B2B4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 27 apr. 2019 kl. 18.52 skrev Eli Zaretskii : >=20 > w32notify cannot watch a single file, because the Windows notification > machinery is directory-oriented, and reports all changes in the > directory. Right; thanks for the correction. 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? --Apple-Mail=_32376299-BAC3-4AE7-8999-FEEE64A7B2B4 Content-Disposition: attachment; filename=0001-Don-t-poll-auto-revert-files-that-use-notification.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Don-t-poll-auto-revert-files-that-use-notification.patch" Content-Transfer-Encoding: quoted-printable =46rom=2091e073992dfdf8ce557e5679a11fb5f1e733f87e=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=2024=20Apr=202019=2018:39:05=20+0200=0A= Subject:=20[PATCH]=20Don't=20poll=20auto-revert=20files=20that=20use=20= notification=0A=0AIt=20is=20a=20waste=20to=20periodically=20poll=20files=20= that=20use=20change=20notification=0Ain=20auto-revert=20mode;=20stop=20= doing=20that.=20=20If=20no=20files=20need=20polling,=0Aturn=20off=20the=20= periodic=20execution=20entirely=20to=20further=20avoid=20wasting=20= power.=0AUse=20a=20timer=20to=20inhibit=20immediate=20reversion=20for=20= some=20time=20after=20a=0Anotification.=0A=0AThis=20change=20does=20not=20= apply=20to=20files=20in=20global-auto-revert-mode,=20where=0Apolling=20= is=20still=20necessary.=20=20It=20is=20disabled=20by=20default,=20and=20= enabled=20by=0Asetting=20`auto-revert-always-poll'=20to=20nil.=0A=0A*=20= lisp/autorevert.el=20(auto-revert--polled-buffers):=20New.=0A= (auto-revert-remove-current-buffer,=20auto-revert-mode)=0A= (global-auto-revert-mode,=20auto-revert-set-timer)=0A= (auto-revert-notify-add-watch,=20auto-revert-buffers):=0AMaintain=20and=20= use=20auto-revert--polled-buffers.=0A(auto-revert-buffers-counter):=20= Remove.=0A(auto-revert-buffers-counter-lockedout):=20Remove.=0A= (auto-revert--lockout-interval):=20New.=0A(auto-revert--lockout-timer):=20= New.=0A(auto-revert-notify-handler):=20Maintain=20and=20use=20= auto-revert--polled-buffers.=0AHonour=20new=20lockout=20timer.=20=20= Start=20lockout=20timer=20if=20necessary.=0A(auto-revert--end-lockout):=20= New.=0A(auto-revert-always-poll):=20New.=0A(auto-revert--need-polling):=20= New.=0A*=20etc/NEWS=20(Changes=20in=20Specialized=20Modes=20and=20= Packages):=20Mention=20the=20change.=0A---=0A=20etc/NEWS=20=20=20=20=20=20= =20=20=20=20=20|=20=2010=20++++=0A=20lisp/autorevert.el=20|=20125=20= +++++++++++++++++++++++++++++++--------------=0A=202=20files=20changed,=20= 98=20insertions(+),=2037=20deletions(-)=0A=0Adiff=20--git=20a/etc/NEWS=20= b/etc/NEWS=0Aindex=20cf6f4fea3e..84a3184e8c=20100644=0A---=20a/etc/NEWS=0A= +++=20b/etc/NEWS=0A@@=20-1389,6=20+1389,16=20@@=20Packages=20deriving=20= from=20'js-mode'=20with=20'define-derived-mode'=20should=0A=20call=20= this=20function=20to=20add=20enabled=20syntax=20extensions=20to=20their=20= mode=0A=20name,=20too.=0A=20=0A+**=20Autorevert=0A+=0A+***=20New=20= variable=20'auto-revert-always-poll'=20for=20saving=20power.=0A+Set=20= this=20variable=20to=20nil=20to=20prevent=20buffers=20in=20auto-revert=20= mode=20from=0A+being=20polled=20for=20changes=20periodically.=20=20This=20= reduces=20the=20power=0A+consumption=20of=20an=20idle=20Emacs,=20but=20= may=20fail=20on=20some=20network=20file=0A+systems.=20=20Make=20sure=20= that=20'auto-revert-notify-exclude-dir-regexp'=0A+matches=20files=20= where=20notification=20is=20not=20supported.=0A+The=20default=20value=20= is=20t.=0A+=0A=20=0C=0A=20*=20New=20Modes=20and=20Packages=20in=20Emacs=20= 27.1=0A=20=0Adiff=20--git=20a/lisp/autorevert.el=20b/lisp/autorevert.el=0A= index=201d20896c83..ae9ca63577=20100644=0A---=20a/lisp/autorevert.el=0A= +++=20b/lisp/autorevert.el=0A@@=20-302,6=20+302,29=20@@=20You=20should=20= set=20this=20variable=20through=20Custom."=0A=20=20=20:type=20'regexp=0A=20= =20=20:version=20"24.4")=0A=20=0A+(defcustom=20auto-revert-always-poll=20= t=0A+=20=20"Non-nil=20to=20poll=20files=20even=20if=20notification=20is=20= available.=0A+=0A+Set=20this=20variable=20to=20nil=20to=20save=20power=20= by=20avoiding=20polling=20when=0A+possible.=20=20Files=20on=20= file-systems=20that=20do=20not=20support=20file=0A+notifications=20must=20= match=20`auto-revert-notify-exclude-dir-regexp'=0A+for=20Auto-Revert=20= to=20work=20properly=20in=20this=20case.=20=20This=20typically=0A= +includes=20network=20file=20systems=20on=20Unix-like=20machines,=20for=20= files=0A+that=20are=20modified=20from=20another=20computer.=0A+=0A+When=20= non-nil,=20buffers=20in=20Auto-Revert=20Mode=20will=20always=20be=20= polled=0A+for=20changes=20to=20their=20files=20on=20disk=20every=20= `auto-revert-interval'=0A+seconds.=0A+=0A+In=20Global=20Auto-Revert=20= Mode,=20polling=20is=20always=20done=20regardless=20of=0A+the=20value=20= of=20this=20variable."=0A+=20=20:group=20'auto-revert=0A+=20=20:type=20= 'boolean=0A+=20=20:set=20(lambda=20(variable=20value)=0A+=20=20=20=20=20=20= =20=20=20(set-default=20variable=20value)=0A+=20=20=20=20=20=20=20=20=20= (auto-revert-set-timer))=0A+=20=20:version=20"27.1")=0A+=0A=20;;=20= Internal=20variables:=0A=20=0A=20(defvar=20auto-revert-buffer-list=20()=0A= @@=20-319,6=20+342,11=20@@=20the=20list=20of=20old=20buffers.")=0A=20= (defvar=20auto-revert-tail-pos=200=0A=20=20=20"Position=20of=20last=20= known=20end=20of=20file.")=0A=20=0A+(defvar=20= auto-revert--polled-buffers=20()=0A+=20=20"List=20of=20buffers=20in=20= Auto-Revert=20Mode=20that=20must=20be=20polled.=0A+It=20contains=20the=20= buffers=20in=20`auto-revert-buffer-list'=20whose=0A= +`auto-revert-notify-watch-descriptor'=20is=20nil.")=0A+=0A=20(defun=20= auto-revert-find-file-function=20()=0A=20=20=20(setq-local=20= auto-revert-tail-pos=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (file-attribute-size=20(file-attributes=20buffer-file-name))))=0A@@=20= -346,8=20+374,12=20@@=20This=20has=20been=20reported=20by=20a=20file=20= notification=20event.")=0A=20(defun=20auto-revert-remove-current-buffer=20= (&optional=20buffer)=0A=20=20=20"Remove=20BUFFER=20from=20= `auto-revert-buffer-list'.=0A=20BUFFER=20defaults=20to=20= `current-buffer'."=0A+=20=20(unless=20buffer=0A+=20=20=20=20(setq=20= buffer=20(current-buffer)))=0A=20=20=20(setq=20auto-revert-buffer-list=0A= -=20=20=20=20=20=20=20=20(delq=20(or=20buffer=20(current-buffer))=20= auto-revert-buffer-list)))=0A+=20=20=20=20=20=20=20=20(delq=20buffer=20= auto-revert-buffer-list))=0A+=20=20(setq=20auto-revert--polled-buffers=0A= +=20=20=20=20=20=20=20=20(delq=20buffer=20auto-revert--polled-buffers)))=0A= =20=0A=20;;;###autoload=0A=20(define-minor-mode=20auto-revert-mode=0A@@=20= -367,6=20+399,7=20@@=20without=20being=20changed=20in=20the=20part=20= that=20is=20already=20in=20the=20buffer."=0A=20=20=20(if=20= auto-revert-mode=0A=20=20=20=20=20=20=20(when=20(not=20(memq=20= (current-buffer)=20auto-revert-buffer-list))=0A=20=20=20=20=20=20=20=20=20= (push=20(current-buffer)=20auto-revert-buffer-list)=0A+=20=20=20=20=20=20= =20=20(push=20(current-buffer)=20auto-revert--polled-buffers)=0A=20=20=20= =20=20=20=20=20=20(add-hook=0A=20=20=20=20=20=20=20=20=20=20= 'kill-buffer-hook=0A=20=20=20=20=20=20=20=20=20=20= #'auto-revert-remove-current-buffer=0A@@=20-479,9=20+512,17=20@@=20= specifies=20in=20the=20mode=20line."=0A=20=20=20=20=20=20=20= (auto-revert-buffers)=0A=20=20=20=20=20(dolist=20(buf=20(buffer-list))=0A= =20=20=20=20=20=20=20(with-current-buffer=20buf=0A-=09(when=20= auto-revert-notify-watch-descriptor=0A+=20=20=20=20=20=20=20=20(when=20= (and=20auto-revert-notify-watch-descriptor=0A+=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(not=20(memq=20buf=20= auto-revert-buffer-list)))=0A=20=09=20=20= (auto-revert-notify-rm-watch))))))=0A=20=0A+(defun=20= auto-revert--need-polling=20()=0A+=20=20"Whether=20periodic=20polling=20= is=20required."=0A+=20=20(or=20global-auto-revert-mode=0A+=20=20=20=20=20= =20(if=20auto-revert-always-poll=0A+=20=20=20=20=20=20=20=20=20=20= auto-revert-buffer-list=0A+=20=20=20=20=20=20=20=20= auto-revert--polled-buffers)))=0A+=0A=20(defun=20auto-revert-set-timer=20= ()=0A=20=20=20"Restart=20or=20cancel=20the=20timer=20used=20by=20= Auto-Revert=20Mode.=0A=20If=20such=20a=20timer=20is=20active,=20cancel=20= it.=20=20Start=20a=20new=20timer=20if=0A@@=20-492,10=20+533,10=20@@=20= will=20use=20an=20up-to-date=20value=20of=20`auto-revert-interval'"=0A=20= =20=20(if=20(timerp=20auto-revert-timer)=0A=20=20=20=20=20=20=20= (cancel-timer=20auto-revert-timer))=0A=20=20=20(setq=20auto-revert-timer=0A= -=09(if=20(or=20global-auto-revert-mode=20auto-revert-buffer-list)=0A-=09= =20=20=20=20(run-with-timer=20auto-revert-interval=0A-=09=09=09=20=20=20=20= auto-revert-interval=0A-=09=09=09=20=20=20=20'auto-revert-buffers))))=0A= +=09(and=20(auto-revert--need-polling)=0A+=09=20=20=20=20=20= (run-with-timer=20auto-revert-interval=0A+=09=09=09=20=20=20=20=20= auto-revert-interval=0A+=09=09=09=20=20=20=20=20'auto-revert-buffers))))=0A= =20=0A=20(defun=20auto-revert-notify-rm-watch=20()=0A=20=20=20"Disable=20= file=20notification=20for=20current=20buffer's=20associated=20file."=0A= @@=20-551,6=20+592,8=20@@=20will=20use=20an=20up-to-date=20value=20of=20= `auto-revert-interval'"=0A=20=09=20=20=20=20=20=20=20(gethash=20= auto-revert-notify-watch-descriptor=0A=20=09=09=20=20=20=20=20=20=20=20= auto-revert--buffers-by-watch-descriptor))=0A=20=20=20=20=20=20=20=20=20=20= auto-revert--buffers-by-watch-descriptor)=0A+=20=20=20=20=20=20=20=20= (setq=20auto-revert--polled-buffers=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(delq=20(current-buffer)=20auto-revert--polled-buffers))=0A=20=20=20= =20=20=20=20=20=20(add-hook=20'kill-buffer-hook=20= #'auto-revert-notify-rm-watch=20nil=20t)))))=0A=20=0A=20;;=20If=20we=20= have=20file=20notifications,=20we=20want=20to=20update=20the=20= auto-revert=20buffers=0A@@=20-558,24=20+601,20=20@@=20will=20use=20an=20= up-to-date=20value=20of=20`auto-revert-interval'"=0A=20;;=20often,=20we=20= want=20to=20skip=20some=20revert=20operations=20so=20that=20we=20don't=20= spend=20all=20our=0A=20;;=20time=20reverting=20the=20buffer.=0A=20;;=0A= -;;=20We=20do=20this=20by=20reverting=20immediately=20in=20response=20to=20= the=20first=20in=20a=20flurry=20of=0A-;;=20notifications.=20We=20= suppress=20subsequent=20notifications=20until=20the=20next=20time=0A-;;=20= `auto-revert-buffers'=20is=20called=20(this=20happens=20on=20a=20timer=20= with=20a=20period=20set=20by=0A-;;=20`auto-revert-interval').=0A-(defvar=20= auto-revert-buffers-counter=201=0A-=20=20"Incremented=20each=20time=20= `auto-revert-buffers'=20is=20called")=0A-(defvar-local=20= auto-revert-buffers-counter-lockedout=200=0A-=20=20"Buffer-local=20value=20= to=20indicate=20whether=20we=20should=20immediately=0A-update=20the=20= buffer=20on=20a=20notification=20event=20or=20not.=20If=0A-=0A-=20=20(=3D=20= auto-revert-buffers-counter-lockedout=0A-=20=20=20=20=20= auto-revert-buffers-counter)=0A-=0A-then=20the=20updates=20are=20locked=20= out,=20and=20we=20wait=20until=20the=20next=20call=0A-of=20= `auto-revert-buffers'=20to=20revert=20the=20buffer.=20If=20no=20lockout=20= is=0A-present,=20then=20we=20revert=20immediately=20and=20set=20the=20= lockout,=20so=20that=0A-no=20more=20reverts=20are=20possible=20until=20= the=20next=20call=20of=0A-`auto-revert-buffers'")=0A+;;=20We=20do=20this=20= by=20reverting=20immediately=20in=20response=20to=20the=20first=20in=20a=0A= +;;=20flurry=20of=20notifications.=20Any=20notifications=20during=20the=20= following=0A+;;=20`auto-revert-lockout-interval'=20seconds=20are=20noted=20= but=20not=20acted=20upon=0A+;;=20until=20the=20end=20of=20that=20= interval.=0A+=0A+(defconst=20auto-revert--lockout-interval=202.5=0A+=20=20= "Duration,=20in=20seconds,=20of=20the=20Auto-Revert=20Mode=20= notification=20lockout.=0A+This=20is=20the=20quiescence=20after=20each=20= notification=20of=20a=20file=20being=0A+changed=20during=20which=20no=20= automatic=20reverting=20takes=20place,=20to=0A+prevent=20many=20updates=20= in=20rapid=20succession=20from=20overwhelming=20the=0A+system.")=0A+=0A= +(defvar-local=20auto-revert--lockout-timer=20nil=0A+=20=20"Timer=20= awaiting=20the=20end=20of=20the=20notification=20lockout=20interval,=20= or=20nil.")=0A=20=0A=20(defun=20auto-revert-notify-handler=20(event)=0A=20= =20=20"Handle=20an=20EVENT=20returned=20from=20file=20notification."=0A= @@=20-604,7=20+643,13=20@@=20no=20more=20reverts=20are=20possible=20= until=20the=20next=20call=20of=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20(file-name-nondirectory=20= buffer-file-name)))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20;;=20A=20buffer=20w/o=20a=20file,=20like=20dired.=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(null=20= buffer-file-name))=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (auto-revert-notify-rm-watch))))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(auto-revert-notify-rm-watch)=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20(when=20(memq=20buffer=20auto-revert-buffer-list)=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(unless=20(memq=20buffer=20= auto-revert--polled-buffers)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(push=20buffer=20auto-revert--polled-buffers))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Restart=20the=20= timer=20if=20it=20wasn't=20running.=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20(unless=20auto-revert-timer=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(auto-revert-set-timer))))))=0A=20=0A= =20=20=20=20=20=20=20=20=20;;=20Loop=20over=20all=20buffers,=20in=20= order=20to=20find=20the=20intended=20one.=0A=20=20=20=20=20=20=20=20=20= (cl-dolist=20(buffer=20buffers)=0A@@=20-630,11=20+675,21=20@@=20no=20= more=20reverts=20are=20possible=20until=20the=20next=20call=20of=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20= auto-revert-notify-modified-p=20t)=0A=20=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20;;=20Revert=20the=20buffer=20now=20if=20we're=20not=20= locked=20out.=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(when=20= (/=3D=20auto-revert-buffers-counter-lockedout=0A-=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= auto-revert-buffers-counter)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(unless=20auto-revert--lockout-timer=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(auto-revert-handler)=0A-=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20(setq=20= auto-revert-buffers-counter-lockedout=0A-=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20= auto-revert-buffers-counter))))))))))=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20(setq=20auto-revert--lockout-timer=0A+=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(run-with-timer=0A= +=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20auto-revert--lockout-interval=20nil=0A+=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20#'auto-revert--end-lockout=20= buffer)))))))))))=0A+=0A+(defun=20auto-revert--end-lockout=20(buffer)=0A= +=20=20"End=20the=20lockout=20period=20after=20a=20notification.=0A+If=20= the=20buffer=20needs=20to=20be=20reverted,=20do=20it=20now."=0A+=20=20= (when=20(buffer-live-p=20buffer)=0A+=20=20=20=20(with-current-buffer=20= buffer=0A+=20=20=20=20=20=20(setq=20auto-revert--lockout-timer=20nil)=0A= +=20=20=20=20=20=20(when=20auto-revert-notify-modified-p=0A+=20=20=20=20=20= =20=20=20(auto-revert-handler)))))=0A=20=0A=20(defun=20= auto-revert-active-p=20()=0A=20=20=20"Check=20if=20auto-revert=20is=20= active=20(in=20current=20buffer=20or=20globally)."=0A@@=20-755,13=20= +810,10=20@@=20This=20function=20is=20also=20responsible=20for=20= removing=20buffers=20no=20longer=20in=0A=20Auto-Revert=20Mode=20from=20= `auto-revert-buffer-list',=20and=20for=20canceling=0A=20the=20timer=20= when=20no=20buffers=20need=20to=20be=20checked."=0A=20=0A-=20=20(setq=20= auto-revert-buffers-counter=0A-=20=20=20=20=20=20=20=20(1+=20= auto-revert-buffers-counter))=0A-=0A=20=20=20(save-match-data=0A-=20=20=20= =20(let=20((bufs=20(if=20global-auto-revert-mode=0A-=09=09=20=20=20=20= (buffer-list)=0A-=09=09=20=20auto-revert-buffer-list))=0A+=20=20=20=20= (let=20((bufs=20(cond=20(global-auto-revert-mode=20(buffer-list))=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (auto-revert-always-poll=20auto-revert-buffer-list)=0A+=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20= auto-revert--polled-buffers)))=0A=20=09=20=20remaining=20new)=0A=20=20=20= =20=20=20=20;;=20Buffers=20with=20remote=20contents=20shall=20be=20= reverted=20only=20if=20the=0A=20=20=20=20=20=20=20;;=20connection=20is=20= established=20already.=0A@@=20-810,8=20+862,7=20@@=20the=20timer=20when=20= no=20buffers=20need=20to=20be=20checked."=0A=20=09(setq=20bufs=20(cdr=20= bufs)))=0A=20=20=20=20=20=20=20(setq=20auto-revert-remaining-buffers=20= bufs)=0A=20=20=20=20=20=20=20;;=20Check=20if=20we=20should=20cancel=20= the=20timer.=0A-=20=20=20=20=20=20(when=20(and=20(not=20= global-auto-revert-mode)=0A-=09=09=20(null=20auto-revert-buffer-list))=0A= +=20=20=20=20=20=20(unless=20(auto-revert--need-polling)=0A=20=20=20=20=20= =20=20=20=20(if=20(timerp=20auto-revert-timer)=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20(cancel-timer=20auto-revert-timer))=0A=20=09(setq=20= auto-revert-timer=20nil)))))=0A--=20=0A2.20.1=20(Apple=20Git-117)=0A=0A= --Apple-Mail=_32376299-BAC3-4AE7-8999-FEEE64A7B2B4--