From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.devel Subject: Re: Clarification about auto-revert-mode and inotify Date: Tue, 21 Oct 2014 12:39:47 -0700 Message-ID: <8761fdryu4.fsf@secretsauce.net> References: <87vbnd9aab.fsf@secretsauce.net> <878uk9s3mh.fsf@secretsauce.net> <83k33t9sqn.fsf@gnu.org> <877fzts0tj.fsf@secretsauce.net> <83h9yx9pvn.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1413920762 16311 80.91.229.3 (21 Oct 2014 19:46:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Oct 2014 19:46:02 +0000 (UTC) Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 21 21:45:56 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XgfNU-0001bp-JH for ged-emacs-devel@m.gmane.org; Tue, 21 Oct 2014 21:45:56 +0200 Original-Received: from localhost ([::1]:53218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgfNU-0005ar-9W for ged-emacs-devel@m.gmane.org; Tue, 21 Oct 2014 15:45:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgfNM-0005Zp-I3 for emacs-devel@gnu.org; Tue, 21 Oct 2014 15:45:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgfNG-0001YO-I1 for emacs-devel@gnu.org; Tue, 21 Oct 2014 15:45:48 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:54550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgfNG-0001YA-9i for emacs-devel@gnu.org; Tue, 21 Oct 2014 15:45:42 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by gateway2.nyi.internal (Postfix) with ESMTP id AE2D020998 for ; Tue, 21 Oct 2014 15:45:41 -0400 (EDT) Original-Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Tue, 21 Oct 2014 15:45:41 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=x-sasl-enc:references:from:to:cc:subject:date:in-reply-to :message-id:mime-version:content-type; s=mesmtp; bh=or5yHPzWqBrw umvuV1/NWtDEXJA=; b=JfDjiAmhXAFU9hPMRSj8Py/Vk3HWJdhe1mmSyZ+SnYLC h+5qHSOHlxwfWQd/nqvOPU/lPEbtDFDxBaVegDsXb0P9akUR+0R8agBi60zE8/XF CLx5K/u2vAylr2vS1BU9bQQbzee7c7qp5TNDbH5U55pXBG9v9NlmgMhQiaM8cSo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:references:from:to:cc:subject :date:in-reply-to:message-id:mime-version:content-type; s= smtpout; bh=or5yHPzWqBrwumvuV1/NWtDEXJA=; b=K4bt1OZcq3sngtJVj5tv /QnFs6XoZP5aXu0mRbagwGXOn6YZL3XMpi6YoO7bEr4N3Ni8r8xuxTv+kyQodvkM xcsqvY8Pyybhg1BaIVWqYQSVwsqw0axX/RA+ND0/mDi1KDRJZwunWd+yVzAPmArL 5p3/ArC+Yy5eFWKWQZI4SX0= X-Sasl-enc: L4JCbSLwImh2OD7a1lR+qTQonluMrertJ+Wm+Isd3eGS 1413920741 Original-Received: from shorty.local (unknown [97.93.45.113]) by mail.messagingengine.com (Postfix) with ESMTPA id 60E4F680197; Tue, 21 Oct 2014 15:45:41 -0400 (EDT) Original-Received: from localhost ([::1] helo=shorty.local) by shorty.local with esmtp (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1XgfND-0006FT-HX; Tue, 21 Oct 2014 12:45:39 -0700 In-reply-to: <83h9yx9pvn.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.111.4.25 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:175671 Archived-At: Eli Zaretskii writes: >> From: Dima Kogan >> Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org >> Date: Tue, 21 Oct 2014 11:59:00 -0700 >> >> The issue I'm trying to solve is that there's a delay between when a >> file is modified and when auto-revert-mode kicks in. > > A "delay" of, say, 0.01 seconds is indistinguishable from zero. OK. Maybe I'm not understanding something then. If I set the delay in the current code to 0.01 seconds, then isn't emacs polling its flag 100 times a second? I recognize that it's not looking at the file system itself, but rather at the flag set by inotify, but this is still work that does not need to be done. If we have inotify telling us when files are updated, then we don't NEED to poll anything. This is in fact the whole point of inotify. The prototype patch I attached earlier reacts to inotify events as soon as they happen, with some throttling, so if a file is updated every 10 seconds, say, then you'll get each update immediately with no polling. If a file is updated every 0.1 seconds, however, then you'll get the first update immediately, and the others with a period of 1 second. The current code set to poll every 0.01 seconds would not only do stuff every 0.01 seconds, but it'll also actually revert the buffer every 0.1 seconds, which is potentially inefficient. The bulk of my patch is the throttling logic. If I take that out, then the patch is one added line.