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: Wed, 8 May 2019 10:34:13 +0200 Message-ID: <78A0704A-59E6-4D25-8FF3-8FD011942885@acm.org> References: <83d0l7v193.fsf@gnu.org> <86EFE367-90FF-4786-BC91-FC28FAF38A4E@acm.org> <877ebdqmbj.fsf@gmx.de> <834l6gu6ee.fsf@gnu.org> <834l6eqdam.fsf@gnu.org> <8bbbdc62bee1dc16b6fd684e7da5ffac43f1e232.camel@acm.org> <87woj9nj77.fsf@gmx.de> <83r29fmz3f.fsf@gnu.org> <6b722334f6eaddcbbf3def636b5181c9439a172c.camel@acm.org> <831s1emvz7.fsf@gnu.org> <26e8159ac86da37d9cf555f6cb3f2dcb63ac0a67.camel@acm.org> <87y33mgo0c.fsf@gmx.de> <05128E42-E970-4C41-9DF9-E9E0BC1C9E4A@acm.org> <87tveagg4f.fsf@gmx.de> <87pnoygdx6.fsf@gmx.de> <8FEB518A-F5AA-488B-BDC5-7947FFE51394@acm.org> <87lfzlgvka.fsf@gmx.de> <3D200C55-AD11-4214-9C50-C2183F6598CC@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_3B40BEB5-A187-44B9-8147-0B2C064C716B" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="112127"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35418@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 08 10:35:23 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 1hOI2r-000T04-1q for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 May 2019 10:35:21 +0200 Original-Received: from localhost ([127.0.0.1]:33198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOI2p-00080b-S7 for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 May 2019 04:35:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOI2Z-0007yg-49 for bug-gnu-emacs@gnu.org; Wed, 08 May 2019 04:35:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOI2Y-0006ei-9x for bug-gnu-emacs@gnu.org; Wed, 08 May 2019 04:35:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46750) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hOI2Y-0006eV-6h for bug-gnu-emacs@gnu.org; Wed, 08 May 2019 04:35:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hOI2X-0007Mp-Ub for bug-gnu-emacs@gnu.org; Wed, 08 May 2019 04:35: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: Wed, 08 May 2019 08:35: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.155730446128268 (code B ref 35418); Wed, 08 May 2019 08:35:01 +0000 Original-Received: (at 35418) by debbugs.gnu.org; 8 May 2019 08:34:21 +0000 Original-Received: from localhost ([127.0.0.1]:60294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOI1t-0007Ls-Ak for submit@debbugs.gnu.org; Wed, 08 May 2019 04:34:21 -0400 Original-Received: from mail230c50.megamailservers.eu ([91.136.10.240]:35096 helo=mail37c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hOI1q-0007Lh-CJ for 35418@debbugs.gnu.org; Wed, 08 May 2019 04:34:19 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1557304456; bh=zz+HIDiCTCnrWnFe2D/vIzaKVyLFYJUpJ/fBvU8TLKw=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=GU93R1UUVtYuKZXGoiXfwSAtPwT5YUCJaW+UdGqjGs5ChgI9QE4Os9IA9v0D5UNaq /9UEGED3KzY4ApiP2Rl9Nz6BU+LlSF5X5odXJPqzEsMCNqy8RWbWm9Q3he09stn3oR qEpjDtJxcWYqgoJLOOLgBINqNHW1gM/STcMiobRI= 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 mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x488YE7m015086; Wed, 8 May 2019 08:34:15 +0000 In-Reply-To: <3D200C55-AD11-4214-9C50-C2183F6598CC@acm.org> X-Mailer: Apple Mail (2.3445.104.8) X-CTCH-RefID: str=0001.0A0B020B.5CD29488.0029, 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=ItQwjo3g c=1 sm=1 tr=0 a=M+GU/qJco4WXjv8D6jB2IA==:117 a=M+GU/qJco4WXjv8D6jB2IA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=0Cmo_GCdd-s-yunitmsA:9 a=CjuIK1q_8ugA:10 a=ausD_beliIWWzayK3jAA:9 a=B2y7HmGcmWMA:10 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:158923 Archived-At: --Apple-Mail=_3B40BEB5-A187-44B9-8147-0B2C064C716B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Here is a detail that needs to be taken care of: we should not use = notification on non-file buffers, since that is generally useless = (consider the Buffer List buffer) and, with `auto-revert-avoid-polling', = prevents these buffers from being polled and thus updated at all. Patch attached. There is a hack for Dired buffers, since watching their = directories happens to be just what we want. It would be nice to = generalise this condition somehow, but meanwhile this will have to do, = unless you can come up with something better. A patch for global-auto-revert-mode will come shortly. --Apple-Mail=_3B40BEB5-A187-44B9-8147-0B2C064C716B Content-Disposition: attachment; filename=0001-Don-t-use-file-notification-on-non-file-buffers.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Don-t-use-file-notification-on-non-file-buffers.patch" Content-Transfer-Encoding: quoted-printable =46rom=2023f8e60c110a372530a839948d7b17598517d928=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Wed,=208=20May=202019=2000:02:59=20+0200=0A= Subject:=20[PATCH]=20Don't=20use=20file=20notification=20on=20non-file=20= buffers=0A=0AMost=20non-file=20buffers=20aren't=20served=20by=20file=20= notification=20in=0Aauto-revert=20mode;=20typically,=20they=20need=20to=20= be=20polled,=20like=20the=20Buffer=20List.=0AWith=20= `auto-revert-avoid-polling',=20setting=20a=20useless=20notification=20= means=0Athat=20such=20buffers=20may=20never=20be=20updated=20at=20all=20= (bug#35418).=0A=0AAn=20exception=20is=20made=20for=20Dired,=20as=20that=20= mode=20works=20well=20with=0Anotification=20on=20the=20directory.=0A=0A*=20= lisp/autorevert.el=20(auto-revert-buffers):=0AModify=20condition=20for=20= using=20notification.=0A---=0A=20lisp/autorevert.el=20|=208=20+++++++-=0A= =201=20file=20changed,=207=20insertions(+),=201=20deletion(-)=0A=0Adiff=20= --git=20a/lisp/autorevert.el=20b/lisp/autorevert.el=0Aindex=20= 7cd5e7ee8b..5a62b5f6b9=20100644=0A---=20a/lisp/autorevert.el=0A+++=20= b/lisp/autorevert.el=0A@@=20-858,8=20+858,14=20@@=20the=20timer=20when=20= no=20buffers=20need=20to=20be=20checked."=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20(auto-revert-remove-current-buffer))=0A=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20(when=20(auto-revert-active-p)=0A=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20Enable=20file=20= notification.=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20= Don't=20bother=20creating=20a=20notifier=20for=20non-file=20buffers=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20;;=20if=20there=20is=20a=20= custom=20`revert-buffer-function'.=0A+=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20;;=20An=20exception=20is=20made=20for=20Dired,=20since=20= that=20mode=20works=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= ;;=20well=20with=20notifiers.=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20(when=20(and=20auto-revert-use-notify=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(not=20= auto-revert-notify-watch-descriptor))=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(not=20= auto-revert-notify-watch-descriptor)=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(or=20buffer-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=20=20= =20=20=20=20=20=20=20(eq=20major-mode=20'dired-mode)))=0A=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(auto-revert-notify-add-watch))=0A= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= (auto-revert-handler)))))=0A=20=09(setq=20bufs=20(cdr=20bufs)))=0A--=20=0A= 2.20.1=20(Apple=20Git-117)=0A=0A= --Apple-Mail=_3B40BEB5-A187-44B9-8147-0B2C064C716B--