all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-devel@gnu.org
Subject: [PATCH] Option for updating modeline VC state.
Date: Sat, 26 Sep 2009 05:10:27 +0200	[thread overview]
Message-ID: <87vdj6ieos.fsf@telefonica.net> (raw)

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  <ofv@wanadoo.es>

	* 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.





             reply	other threads:[~2009-09-26  3:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-26  3:10 Óscar Fuentes [this message]
2009-09-28  0:57 ` [PATCH] Option for updating modeline VC state Stefan Monnier
2009-09-28  1:30   ` Óscar Fuentes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vdj6ieos.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.