=== modified file 'lisp/vc/vc-dir.el' --- lisp/vc/vc-dir.el 2012-08-13 21:31:56 +0000 +++ lisp/vc/vc-dir.el 2012-09-22 22:43:38 +0000 @@ -1227,12 +1227,25 @@ (setq backend (vc-responsible-backend dir))) (let (pop-up-windows) ; based on cvs-examine; bug#6204 (pop-to-buffer (vc-dir-prepare-status-buffer "*vc-dir*" dir backend))) - (if (derived-mode-p 'vc-dir-mode) - (vc-dir-refresh) + ;; If the mode matches, the buffer was only buried and should be up to date. + (unless (derived-mode-p 'vc-dir-mode) ;; FIXME: find a better way to pass the backend to `vc-dir-mode'. (let ((use-vc-backend backend)) (vc-dir-mode)))) +;;;###autoload +(defun vc-root-dir () + "Show the VC status of the current buffer's repository. +If the buffer is not visiting a version controlled file, or if +the backend does not support function `root', prompt for +directory. See `vc-dir' for more details." + (interactive) + (let* ((backend (vc-backend (buffer-file-name))) + (dir (and backend (vc-call-backend backend 'root buffer-file-name)))) + (if dir + (vc-dir dir backend) + (call-interactively 'vc-dir)))) + (defun vc-default-dir-extra-headers (_backend _dir) ;; Be loud by default to remind people to add code to display ;; backend specific headers. === modified file 'lisp/vc/vc-hooks.el' --- lisp/vc/vc-hooks.el 2012-07-11 23:13:41 +0000 +++ lisp/vc/vc-hooks.el 2012-09-22 21:31:00 +0000 @@ -923,7 +923,7 @@ (define-key map "a" 'vc-update-change-log) (define-key map "b" 'vc-switch-backend) (define-key map "c" 'vc-rollback) - (define-key map "d" 'vc-dir) + (define-key map "d" 'vc-root-dir) (define-key map "g" 'vc-annotate) (define-key map "h" 'vc-insert-headers) (define-key map "i" 'vc-register) @@ -1005,9 +1005,9 @@ (bindings--define-key map [vc-register] '(menu-item "Register" vc-register :help "Register file set into a version control system")) - (bindings--define-key map [vc-dir] - '(menu-item "VC Dir" vc-dir - :help "Show the VC status of files in a directory")) + (bindings--define-key map [vc-root-dir] + '(menu-item "VC Dir" vc-root-dir + :help "Show the VC status of the repository")) map)) (defalias 'vc-menu-map vc-menu-map)