[[[ Naive way to prevent VC from contacting remote repository when saving a file. *** FOR DISCUSSION ONLY; DO NOT APPLY THIS PATCH *** * lisp/vc/vc-hooks.el (vc-state-refresh): Take new 'local flag, pass it along to `vc-call-backend'... But this is problematic because it probably doesn't mean the right thing for backends other than SVN. (vc-after-save): Pass new flag to `vc-state-refresh'. ]]] diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 61918c9..03a45eb 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -486,11 +486,13 @@ status of this file. Otherwise, the value returned is one of: (when backend (vc-state-refresh file backend))))) -(defun vc-state-refresh (file backend) - "Quickly recompute the `state' of FILE." +(defun vc-state-refresh (file backend &optional local) + "Quickly recompute the `state' of FILE. +Optional argument LOCAL means compute state in a way that does +not involve contacting any remote repository." (vc-file-setprop file 'vc-state - (vc-call-backend backend 'state file))) + (vc-call-backend backend 'state file local))) (defsubst vc-up-to-date-p (file) "Convenience function that checks whether `vc-state' of FILE is `up-to-date'." @@ -661,7 +663,7 @@ Before doing that, check if there are any old backups and get rid of them." (if (equal (vc-file-getprop file 'vc-checkout-time) (nth 5 (file-attributes file))) (vc-file-setprop file 'vc-checkout-time nil)) - (if (vc-state-refresh file backend) + (if (vc-state-refresh file backend 'local) (vc-mode-line file backend))) ;; If we saved an unlocked file on a locking based VCS, that ;; file is not longer up-to-date.