From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#18958: 25.0.50; auto-revert-mode reacts slowly even if using an event-driven backend Date: Fri, 20 Feb 2015 19:38:39 -0800 Message-ID: <87k2zc9bda.fsf@secretsauce.net> References: <878ujpcw07.fsf@secretsauce.net> <871tll63de.fsf@gmx.de> <87lhjsaoje.fsf@secretsauce.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1424490326 19872 80.91.229.3 (21 Feb 2015 03:45:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Feb 2015 03:45:26 +0000 (UTC) Cc: 18958@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 21 04:45:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1YP10C-0007QP-9w for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Feb 2015 04:45:12 +0100 Original-Received: from localhost ([::1]:35041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YP10B-00089g-6Y for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Feb 2015 22:45:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YP106-00086a-Rk for bug-gnu-emacs@gnu.org; Fri, 20 Feb 2015 22:45:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YP103-0000he-It for bug-gnu-emacs@gnu.org; Fri, 20 Feb 2015 22:45:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YP103-0000gC-1R for bug-gnu-emacs@gnu.org; Fri, 20 Feb 2015 22:45:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YP102-0007Jh-Gn for bug-gnu-emacs@gnu.org; Fri, 20 Feb 2015 22:45:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Feb 2015 03:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18958 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18958-submit@debbugs.gnu.org id=B18958.142449029428090 (code B ref 18958); Sat, 21 Feb 2015 03:45:02 +0000 Original-Received: (at 18958) by debbugs.gnu.org; 21 Feb 2015 03:44:54 +0000 Original-Received: from localhost ([127.0.0.1]:49784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YP0zt-0007J0-RP for submit@debbugs.gnu.org; Fri, 20 Feb 2015 22:44:54 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:51775) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YP0zq-0007Ip-Jl for 18958@debbugs.gnu.org; Fri, 20 Feb 2015 22:44:51 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 1BF5120BEF for <18958@debbugs.gnu.org>; Fri, 20 Feb 2015 22:44:49 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Fri, 20 Feb 2015 22:44:49 -0500 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=ZJZZcLTdwD7C Ac5CDI1qWMemyiM=; b=iBBwPRsKNRkOsJBwHvs2cR15bPxc3RLeqwaCuR4t2Bpb mHjNp/h+0kiEriuSsLpnXcNGJi6MMp4w0kRtuzIJyLo9vV8yveN/fFPvu73VZPXg lrGVzb3MK4T44xMgktYdPJldmOtmDoX6gviZ80zj2kLJRaVlw0x3H5x4Mj9VeoI= 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=ZJZZcLTdwD7CAc5CDI1qWMemyiM=; b=tqXvub4bYNZyGH0ZXTQ0 gJ6uMtnM5xclRRu1Bmc7zJv8KZJjGchV3scZcZuYoFJyd9HMoV4e/4hpd40CB8GS P4TsikoGEmF7P1EdM+nWdHq1yN6G+627aeViGRs0v4RCEPzq7ZMKr5/qbBRXWUrT NO7eFlzlA13DEgIaaI9/C50= X-Sasl-enc: gJQ4/L0X503VzSOXKZ18qQwu7ZhRQh8xcwCv/Nz0JDGR 1424490289 Original-Received: from shorty.local (unknown [76.91.145.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 62E83680170; Fri, 20 Feb 2015 22:44:49 -0500 (EST) Original-Received: from ip6-localhost ([::1] helo=shorty) by shorty.local with esmtp (Exim 4.84) (envelope-from ) id 1YP0zp-00088P-GM; Fri, 20 Feb 2015 19:44:49 -0800 In-reply-to: <87lhjsaoje.fsf@secretsauce.net> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99666 Archived-At: --=-=-= Content-Type: text/plain Dima Kogan writes: > The notification throttling seems to have a problem. Recipe: Hi. I figured this out. The notification handler was being installed during a timer update, NOT when auto-revert-mode was initiated. So in order for the code to work you'd have to - M-x auto-revert-mode - wait for the timer. ~5 seconds or so - update file If you didn't wait, then this first update would be ignored. The code to install the handler when needed was already there, but for some reason it was disabled. Attaching a patch that makes it work for all of auto-revert-mode, auto-revert-tail-mode and global-auto-revert-mode. This patch removes (let (auto-revert-use-notify) ... ) wrappers to let the existing code to its thing, and for auto-revert-tail-mode this patch calls (auto-revert-buffers) instead of (auto-revert-handler), like the other two code paths already do. Truthfully, it probably does make sense to call (auto-revert-handler) for the two non-global functions, but the handler-install code would then need to be moved. I still need to double-check the gfile stuff, and I'll do that when I get your ok on this. The gfile also has a delay in glib itself, so this wouldn't be as nice as inotify until glib is patched. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-notification-handler-is-now-installed-when-auto-reve.patch >From bb2dec478fce20a25a737f16f26c0b338d599552 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Fri, 20 Feb 2015 19:38:17 -0800 Subject: [PATCH] notification handler is now installed when auto-revert-mode is entered --- lisp/autorevert.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 02cef24..4dd021e 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el @@ -361,9 +361,8 @@ without being changed in the part that is already in the buffer." (delq (current-buffer) auto-revert-buffer-list))) (auto-revert-set-timer) (when auto-revert-mode - (let (auto-revert-use-notify) - (auto-revert-buffers) - (setq auto-revert-tail-mode nil)))) + (auto-revert-buffers) + (setq auto-revert-tail-mode nil))) ;;;###autoload @@ -417,8 +416,7 @@ Use `auto-revert-mode' for changes other than appends!" (y-or-n-p "File changed on disk, content may be missing. \ Perform a full revert? ") ;; Use this (not just revert-buffer) for point-preservation. - (let (auto-revert-use-notify) - (auto-revert-handler))) + (auto-revert-buffers)) ;; else we might reappend our own end when we save (add-hook 'before-save-hook (lambda () (auto-revert-tail-mode 0)) nil t) (or (local-variable-p 'auto-revert-tail-pos) ; don't lose prior position @@ -463,8 +461,7 @@ specifies in the mode line." :global t :group 'auto-revert :lighter global-auto-revert-mode-text (auto-revert-set-timer) (if global-auto-revert-mode - (let (auto-revert-use-notify) - (auto-revert-buffers)) + (auto-revert-buffers) (dolist (buf (buffer-list)) (with-current-buffer buf (when auto-revert-use-notify -- 2.0.0 --=-=-=--