From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#21559: [PATCH] autorevert: Wait a while before calling vc-find-file-hook Date: Thu, 29 Oct 2015 09:20:25 +0100 Message-ID: <87vb9qulva.fsf@gmx.de> References: <1445885018-17451-1-git-send-email-ben@smart-cactus.org> <1445885018-17451-2-git-send-email-ben__31073.4246545055$1445885089$gmane$org@smart-cactus.org> <87fv0wogyx.fsf@gmx.de> <87a8r3w6dw.fsf@smart-cactus.org> <87k2q7127u.fsf@gmx.de> <8737wux6s0.fsf@smart-cactus.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1446106887 11023 80.91.229.3 (29 Oct 2015 08:21:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Oct 2015 08:21:27 +0000 (UTC) Cc: 21559@debbugs.gnu.org To: Ben Gamari Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 29 09:21:18 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 1ZriST-0007TE-DN for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Oct 2015 09:21:17 +0100 Original-Received: from localhost ([::1]:42595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZriSM-0004Vj-CT for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Oct 2015 04:21:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZriSH-0004VX-TC for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 04:21:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZriSE-0006CH-P5 for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 04:21:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZriSE-0006CD-LY for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 04:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZriSE-0006mB-8Z for bug-gnu-emacs@gnu.org; Thu, 29 Oct 2015 04:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Oct 2015 08:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21559 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21559-submit@debbugs.gnu.org id=B21559.144610684826016 (code B ref 21559); Thu, 29 Oct 2015 08:21:02 +0000 Original-Received: (at 21559) by debbugs.gnu.org; 29 Oct 2015 08:20:48 +0000 Original-Received: from localhost ([127.0.0.1]:43202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZriRz-0006lX-Fj for submit@debbugs.gnu.org; Thu, 29 Oct 2015 04:20:47 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:61266) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZriRe-0006l3-Q2 for 21559@debbugs.gnu.org; Thu, 29 Oct 2015 04:20:45 -0400 Original-Received: from detlef.gmx.de ([79.195.15.93]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MS5Dm-1a3El13xAg-00THPz; Thu, 29 Oct 2015 09:20:26 +0100 In-Reply-To: <8737wux6s0.fsf@smart-cactus.org> (Ben Gamari's message of "Wed, 28 Oct 2015 18:05:51 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emac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BI1Ce0jRNCg3Bmz6qq1hgwlNlGo8jMArI 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: 208.118.235.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:108139 Archived-At: Ben Gamari writes: > Hi Michael, Hi Ben, > Ultimately the problem here is an annoyingly narrow one, namely the fact > that auto-revert's action is correlated with file modifications due to > rebasing. For this reason I think it may be best to keep the solution > confined to auto-revert. > > In particular, I'm afraid that the changing the semantics of > revert-buffer may break other users of this function who expect > its effect to be apparent immediately after invocation. It seems like > this approach may easily and unwittingly trade one subtle form of > breakage for another (even harder to find) one. I agree with you not to change the behaviour of revert-buffer for other use cases but auto-revert. One could do it by introducing a new local variable auto-revert-buffer-in-progress-p (similar to revert-buffer-in-progress-p), which is bound during auto-revert. Then it would be possible to define a new function (defun vc-git-revert-buffer-function (ignore-auto noconfirm) "vc-git specific revert function." (if (and auto-revert-buffer-in-progress-p (check-for-git-rebase)) (do-something-special) (revert-buffer--default ignore-auto noconfirm))) One could also check, whether adding a function to before-revert-hook could be helpful. An alternative, w/o touching revert-buffer for vc-git files, would be the provisiong of a special buffer-stale-function for vc-git. Something like (defun vc-git-buffer-stale-p (&optional noconfirm) "vc-git specific buffer-stale function." (check-that-git-needs-revert-and-it-is-safe-to-do-so)) This function returns t, when a buffer with a file under vc-git mode needs a revert, and it is safe to revert it (no git rebase is running). When autorevert either polls, or it is indicated by a file notification event, it calls this function and reverts the buffer if the function returns non-nil. If the function returns nil, auto-revert is skipped for that buffer, and it is checked again by the next poll (after 5 seconds). By this, autorevert.el would stay clean (no additional vc related code), and you would even not need to implement an own timer. > Cheers, > > - Ben Best regards, Michael.