From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?windows-1252?Q?=D3scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: [PATCH] Option for updating modeline VC state. Date: Sat, 26 Sep 2009 05:10:27 +0200 Message-ID: <87vdj6ieos.fsf@telefonica.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1253934671 23686 80.91.229.12 (26 Sep 2009 03:11:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Sep 2009 03:11:11 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 26 05:11:04 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MrNge-0000vi-F6 for ged-emacs-devel@m.gmane.org; Sat, 26 Sep 2009 05:11:04 +0200 Original-Received: from localhost ([127.0.0.1]:54785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrNgd-0002MS-T7 for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 23:11:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrNgZ-0002MN-6p for emacs-devel@gnu.org; Fri, 25 Sep 2009 23:10:59 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrNgT-0002MB-Es for emacs-devel@gnu.org; Fri, 25 Sep 2009 23:10:57 -0400 Original-Received: from [199.232.76.173] (port=59180 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrNgT-0002M8-Bb for emacs-devel@gnu.org; Fri, 25 Sep 2009 23:10:53 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:50269) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MrNgS-0000sm-Ua for emacs-devel@gnu.org; Fri, 25 Sep 2009 23:10:53 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.50) id 1MrNgR-0000tJ-2G for emacs-devel@gnu.org; Sat, 26 Sep 2009 05:10:51 +0200 Original-Received: from 24.red-83-43-52.dynamicip.rima-tde.net ([83.43.52.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Sep 2009 05:10:51 +0200 Original-Received: from ofv by 24.red-83-43-52.dynamicip.rima-tde.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 26 Sep 2009 05:10:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 67 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 24.red-83-43-52.dynamicip.rima-tde.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) Cancel-Lock: sha1:+1y6hTdRCtPTjOwnv14OBOCJ56A= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115651 Archived-At: This comes from http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4515 In short, the VC state modeline is changed to signal `edited' the first time the file is saved. Even if subsequent editions revert the file to its pristine state, the VC state modeline will keep showing the `edited' flag. As Dan is concerned about performance issues if VC asks the backend for the state of the file, this is implemented as an option disabled by default. 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.