From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?=C3=93scar?= Fuentes Newsgroups: gmane.emacs.bugs Subject: bug#4515: 23.1.50; Reverting changes on versioned file does not revert vc modeline status Date: Thu, 24 Sep 2009 08:24:02 +0200 Message-ID: <87skeckghp.fsf@telefonica.net> References: <87ws3rlnny.fsf@telefonica.net> <200909230553.n8N5rEsT023798@godzilla.ics.uci.edu> <87eipykve3.fsf@telefonica.net> <200909231836.n8NIa6Lv029481@godzilla.ics.uci.edu> <874oqtlaq0.fsf@telefonica.net> <200909240424.n8O4OjLB004582@godzilla.ics.uci.edu> Reply-To: =?UTF-8?Q?=C3=93scar?= Fuentes , 4515@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1253774847 12809 80.91.229.12 (24 Sep 2009 06:47:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 24 Sep 2009 06:47:27 +0000 (UTC) Cc: 4515@emacsbugs.donarmstrong.com To: Dan Nicolaescu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 24 08:47:20 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mqi6o-0001H4-76 for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Sep 2009 08:47:19 +0200 Original-Received: from localhost ([127.0.0.1]:35155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mqi6n-0004B0-IN for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Sep 2009 02:47:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mqi6j-0004Av-AD for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 02:47:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mqi6d-00047R-LM for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 02:47:11 -0400 Original-Received: from [199.232.76.173] (port=56824 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mqi6d-000472-C8 for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 02:47:07 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:7426) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mqi6c-00017w-RD for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 02:47:07 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mqi6b-0004bh-LQ for bug-gnu-emacs@gnu.org; Thu, 24 Sep 2009 02:47:06 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8O6l3Sh023244; Wed, 23 Sep 2009 23:47:03 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n8O6U4Rq020427; Wed, 23 Sep 2009 23:30:04 -0700 Resent-Date: Wed, 23 Sep 2009 23:30:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: =?UTF-8?Q?=C3=93scar?= Fuentes Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Thu, 24 Sep 2009 06:30:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4515 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4515-submit@emacsbugs.donarmstrong.com id=B4515.125377344719555 (code B ref 4515); Thu, 24 Sep 2009 06:30:04 +0000 Original-Received: (at 4515) by emacsbugs.donarmstrong.com; 24 Sep 2009 06:24:07 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from IMPaqm2.telefonica.net (impaqm2.telefonica.net [213.4.138.2]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8O6O4Rg019544 for <4515@emacsbugs.donarmstrong.com>; Wed, 23 Sep 2009 23:24:06 -0700 Original-Received: from IMPmailhost4.adm.correo ([10.20.102.125]) by IMPaqm2.telefonica.net with bizsmtp id kVyW1c00D2iL0W23MWQ3yz; Thu, 24 Sep 2009 08:24:03 +0200 Original-Received: from qcore ([83.43.52.24]) by IMPmailhost4.adm.correo with BIZ IMP id kWLl1c00F0XKxp71kWLm52; Thu, 24 Sep 2009 08:20:47 +0200 X-TE-authinfo: authemail="981711563$telefonica.net" |auth_email="981711563@telefonica.net" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" In-Reply-To: <200909240424.n8O4OjLB004582@godzilla.ics.uci.edu> (Dan Nicolaescu's message of "Wed, 23 Sep 2009 21:24:45 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by mx20.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Resent-Date: Thu, 24 Sep 2009 02:47:11 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:31438 Archived-At: Dan Nicolaescu writes: > Stefan Monnier writes: > > > > Automatically checking the VC state after each save is actually > > > performed if there is a vc-dired buffer for the working copy where the > > > file resides. That check updates the vc-dired with the correct state of > > > the saved file. > > > > Indeed. That requires the status info to be obtainable cheaply. > > There's a major difference: vc-dir is asynchronous, whereas updating the > same info when saving a file is synchronous, so it will be on the > critical path. Are you saying that vc-dir updates the file status asynchronously after a file is saved? vc-dir-recompute-file-state does (state (vc-call-backend vc-dir-backend 'state fname)) (extra (vc-call-backend vc-dir-backend 'status-fileinfo-extra fname))) which looks like the same stuff vc-after-save is trying to avoid. I've implemented the option for checking the state after every save. It is almost instantaneous on a GNU/Linux machine with bzr. On a Windows XP netbook there is almost no noticeable delay with a hot cache. Using bzr 2.0rc on a 1000 rev branch. The option is off by default so the user must toggle the option before complaining about the performance. The docstring of the defcustom warns about that posibility. 2009-09-24 Oscar Fuentes * lisp/vc-hooks.el (vc-always-update-modeline-after-save): new defcustom. (vc-after-save): Use it and when non-nil check the vc file state so the modeline reflects its actual state. diff -cp "c:/apps/emacs/lisp/vc-hooks.el" "d:/vc-hooks.el" *** c:/apps/emacs/lisp/vc-hooks.el 2009-09-24 07:25:53.000000000 +0200 --- d:/vc-hooks.el 2009-09-24 08:10:01.062500000 +0200 *************** If nil (the default), files covered by v *** 96,101 **** --- 96,110 ---- :group 'vc :group 'backup) + (defcustom vc-always-update-modeline-after-save nil + "If non-nil, always update the state shown in the modeline + after saving the file. This may be time-consuming for some + backends. If nil, the modeline changes to `edited' when the file + is saved for the first time and it is not updated on subsequent + saves." + :type 'boolean + :group 'vc) + (defcustom vc-follow-symlinks 'ask "What to do if visiting a symbolic link to a file under version control. Editing such a file through the link bypasses the version control system, *************** Before doing that, check if there are an *** 743,751 **** ;; to avoid confusion. (vc-file-setprop file 'vc-checkout-time nil)) t) - (vc-up-to-date-p file) (eq (vc-checkout-model backend (list file)) 'implicit) ! (vc-file-setprop file 'vc-state 'edited) (vc-mode-line file backend) ;; Try to avoid unnecessary work, a *vc-dir* buffer is ;; present if and only if this is true. --- 752,766 ---- ;; to avoid confusion. (vc-file-setprop file 'vc-checkout-time nil)) t) (eq (vc-checkout-model backend (list file)) 'implicit) ! (if vc-always-update-modeline-after-save ! (progn ! ;; Avoid using cached value on `vc-state': ! (vc-file-setprop file 'vc-state 'nil) ! (vc-file-setprop file 'vc-state (vc-state file backend))) ! (and ! (vc-up-to-date-p file) ! (vc-file-setprop file 'vc-state 'edited))) (vc-mode-line file backend) ;; Try to avoid unnecessary work, a *vc-dir* buffer is ;; present if and only if this is true.