Mercurial > emacs
diff lisp/vc-hooks.el @ 105293:8bfe20e0336c
* vc-hooks.el (vc-dir-buffers): New var.
(vc-state-refresh): New function.
(vc-state): Use it.
(vc-after-save): Always ask the backend to recompute the new state.
Always call vc-dir if necessary, using vc-dir-buffers.
* vc-dir.el (vc-dir-prepare-status-buffer, vc-dir-resynch-file):
Use vc-dir-buffers.
(vc-dir-mode): Use vc-dir-buffers rather than after-save-hook.
(vc-dir-prepare-status-buffer, vc-dir-update)
(vc-dir-resync-directory-files, vc-dir-resynch-file, vc-dir-mode):
Don't call expand-file-name on default-directory.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 29 Sep 2009 13:07:50 +0000 |
parents | f8ba8d6fd250 |
children | 6b8dce5c4461 |
line wrap: on
line diff
--- a/lisp/vc-hooks.el Tue Sep 29 07:38:42 2009 +0000 +++ b/lisp/vc-hooks.el Tue Sep 29 13:07:50 2009 +0000 @@ -517,12 +517,16 @@ ;; FIXME: New (sub)states needed (?): ;; - `copied' and `moved' (might be handled by `removed' and `added') (or (vc-file-getprop file 'vc-state) - (when (> (length file) 0) + (when (> (length file) 0) ;Why?? --Stef (setq backend (or backend (vc-backend file))) (when backend - (vc-file-setprop - file 'vc-state - (vc-call-backend backend 'state-heuristic file)))))) + (vc-state-refresh file backend))))) + +(defun vc-state-refresh (file backend) + "Quickly recompute the `state' of FILE." + (vc-file-setprop + file 'vc-state + (vc-call-backend backend 'state-heuristic file))) (defsubst vc-up-to-date-p (file) "Convenience function that checks whether `vc-state' of FILE is `up-to-date'." @@ -728,6 +732,8 @@ (declare-function vc-dir-resynch-file "vc-dir" (&optional fname)) +(defvar vc-dir-buffers nil "List of vc-dir buffers.") + (defun vc-after-save () "Function to be called by `basic-save-buffer' (in files.el)." ;; If the file in the current buffer is under version control, @@ -743,14 +749,13 @@ ;; 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. - (when (memq 'vc-dir-resynch-file after-save-hook) - (vc-dir-resynch-file file))))) + (vc-state-refresh file backend) + (vc-mode-line file backend)) + ;; Try to avoid unnecessary work, a *vc-dir* buffer is + ;; present if this is true. + (when vc-dir-buffers + (vc-dir-resynch-file file)))) (defvar vc-menu-entry '(menu-item "Version Control" vc-menu-map