From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#11757: Acknowledgement (24.1.50; vc-git calls `process-file' too many times) Date: Sun, 01 Jul 2012 18:58:01 +0400 Message-ID: <4FF06579.4000101@yandex.ru> References: <4FE2832A.1030308@yandex.ru> <4FE994E8.9020605@yandex.ru> <87zk7qs21q.fsf@gmx.de> <4FEBAAAA.3030102@yandex.ru> <87d34igrie.fsf@gmx.de> <4FEDD2A0.3010300@yandex.ru> <878vf66pgw.fsf@gmx.de> <4FEDDFD8.1010407@yandex.ru> <87wr2pgoiy.fsf@gmx.de> <4FEEF763.2060806@yandex.ru> <878vf5544d.fsf@gmx.de> <4FEF3A87.6000904@yandex.ru> <874nps63ki.fsf@gmx.de> <4FEF500A.9060103@yandex.ru> <87pq8f4xbv.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1341154724 10699 80.91.229.3 (1 Jul 2012 14:58:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 1 Jul 2012 14:58:44 +0000 (UTC) To: 11757@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 01 16:58:44 2012 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 1SlLbj-0001A6-AO for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jul 2012 16:58:39 +0200 Original-Received: from localhost ([::1]:46463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlLbi-0003rp-ED for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jul 2012 10:58:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlLbf-0003rk-2O for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2012 10:58:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SlLbd-0000LZ-5g for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2012 10:58:34 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlLbc-0000LV-Rq for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2012 10:58:33 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SlLfy-0003uP-Fe for bug-gnu-emacs@gnu.org; Sun, 01 Jul 2012 11:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jul 2012 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11757 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11757-submit@debbugs.gnu.org id=B11757.134115495614988 (code B ref 11757); Sun, 01 Jul 2012 15:03:02 +0000 Original-Received: (at 11757) by debbugs.gnu.org; 1 Jul 2012 15:02:36 +0000 Original-Received: from localhost ([127.0.0.1]:40470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SlLfY-0003tg-7y for submit@debbugs.gnu.org; Sun, 01 Jul 2012 11:02:36 -0400 Original-Received: from forward17.mail.yandex.net ([95.108.253.142]:35120) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SlLfT-0003tW-Fk for 11757@debbugs.gnu.org; Sun, 01 Jul 2012 11:02:34 -0400 Original-Received: from smtp19.mail.yandex.net (smtp19.mail.yandex.net [95.108.252.19]) by forward17.mail.yandex.net (Yandex) with ESMTP id 994251060E60 for <11757@debbugs.gnu.org>; Sun, 1 Jul 2012 18:57:59 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1341154679; bh=HhVg0Ld86ERQgPIRekEouNu7qHFNCfmJCIAboFc1r3Y=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=erlN2NfcGMFx0JNtYA4Cb7tSw2jihSBaA8Cg/YIuA/JzvkUgqKYBNuTEElT4mgKla iAa1/Mn5Ry9TUj63l+HrWpiEoAC9bxMODJGtROxLLa/8oI3RPgwshnOptSZS8DUUcN +qUaD99uBttGz4/bZ1mc/xayK2xsiVfOZYqDwxXE= Original-Received: from smtp19.mail.yandex.net (localhost [127.0.0.1]) by smtp19.mail.yandex.net (Yandex) with ESMTP id 8891CBE011F for <11757@debbugs.gnu.org>; Sun, 1 Jul 2012 18:57:59 +0400 (MSK) Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp19.mail.yandex.net (nwsmtp/Yandex) with ESMTP id vxOq63d0-vxOG1NhQ; Sun, 1 Jul 2012 18:57:59 +0400 X-Yandex-Rcpt-Suid: 11757@debbugs.gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1341154679; bh=HhVg0Ld86ERQgPIRekEouNu7qHFNCfmJCIAboFc1r3Y=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=ErYfHAYN2LdY4PH2WZXcMJ3jpBiR55s1C8TGT/0/tkIElN99SVUIkhuxpZiibKcd0 RUGhzdmDItUaaTGq6wYWjJuBi20/oR28IHW3qeOzXweGl8tAwWiInU9nBqHrCq2Ztd QuYBvbDJEx9E0z8a2LGSyBeQ7HazM/nSBW0uzbic= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: <87pq8f4xbv.fsf@gmx.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:61462 Archived-At: Sorry, forgot to cc. On 01.07.2012 13:58, Michael Albinus wrote: > Dmitry Gutov writes: > >>>> I'm not sure what we should do. Call (vc-mode-line) anyway? That would work. >>> >>> Nope. This is expansive, because it recomputes `vc-working-revision'. We >>> would loose all improvements from using the cache. >> >> I don't think so. >> >> If we hadn't reset all properties in vc-before-save (file existed), >> nothing changes. >> If we did reset them, then yes, vc-working-revision will recompute >> vc-working-revision property, but only once after the reset. >> Which is what we want to do anyway, since the file's state has >> changed, and the working revision could have changed as well, so we >> need to know them to update mode-line. > > Likely, the best option is to call (vc-registered file) after clearing > the file cache. This recomputes the 'vc-backend property as well, what > we want. Have you tried this? (vc-backend file) gets called just a bit later, in `vc-after-save`, and it calls `vc-registered' in turn, but since the file is no longer registered with Git, it returns nil, and the mode-line is not updated. Also, I don't think we should call (vc-backend file) before the file is written to disk. > Calling (vc-mode-line file) at this point would be for the side-effect > of that function, which is bad in my experience. It would harden > maintenance, 'cause nobody will know why we want to refresh the modeline > at this point. I meant, always calling (vc-mode-line file) in `vc-after-save', moving it outside of the (and backend ...) check. This does have a performance downside with non-VC file buffers, of a couple additional function calls, 'vc-backend cache lookup, and unconditional mode-line update. So from this standpoint, saving and restoring 'vc-backend value around clearing props in `vc-before-save' might indeed be the best solution. >> By the way, this last patch I sent doesn't help if the user just >> removed the file from repository while leaving it on disk (git rm >> --cached ... && git commit ..., for example), but whatever. > > If we use the cache, there will always be a constellation that the cache > is stale due to external operations. As Stefan said, this is mostly > uncritical. I'm bringing attention to these cases because they could be the actual benefit of your patch (caching 'git-registered) over my initial patch (not calling `vc-git-registered' from `vc-git-state' at all). The original code supported these edge cases, at the cost of additional process call. -- Dmitry