* lisp/vc/vc-dir.el (vc-dir-root): New command (bug#12492, bug#34949).

* lisp/vc/vc-hooks.el (vc-menu-map): Change menu command from
'vc-dir' to 'vc-dir-root'.
This commit is contained in:
Juri Linkov 2020-03-29 02:08:05 +02:00
parent d1b8179f55
commit 52fab66c27
3 changed files with 18 additions and 4 deletions

View file

@ -111,6 +111,10 @@ details of marking the file at the end of the region.
*** State changing VC operations are supported in 'dired-mode' on files
(but still not on directories).
** Change Logs and VC
*** New command 'vc-dir-root' uses the root directory without asking.
** Gnus
---

View file

@ -1286,6 +1286,16 @@ state of item at point, if any."
(setq model (vc-checkout-model vc-dir-backend only-files-list))))
(list vc-dir-backend files only-files-list state model)))
;;;###autoload
(defun vc-dir-root ()
"Run `vc-dir' in the repository root directory without prompt.
If the default directory of the current buffer is
not under version control, prompt for a directory."
(interactive)
(let ((root-dir (vc-root-dir)))
(if root-dir (vc-dir root-dir)
(call-interactively 'vc-dir))))
;;;###autoload
(defun vc-dir (dir &optional backend)
"Show the VC status for \"interesting\" files in and below DIR.
@ -1309,7 +1319,7 @@ These are the commands available for use in the file status buffer:
;; When you hit C-x v d in a visited VC file,
;; the *vc-dir* buffer visits the directory under its truename;
;; therefore it makes sense to always do that.
;; Otherwise if you do C-x v d -> C-x C-f -> C-c v d
;; Otherwise if you do C-x v d -> C-x C-f -> C-x v d
;; you may get a new *vc-dir* buffer, different from the original
(file-truename (read-directory-name "VC status for directory: "
(vc-root-dir) nil t

View file

@ -972,9 +972,9 @@ In the latter case, VC mode is deactivated for this buffer."
(bindings--define-key map [vc-ignore]
'(menu-item "Ignore File..." vc-ignore
:help "Ignore a file under current 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-dir-root]
'(menu-item "VC Dir" vc-dir-root
:help "Show the VC status of the repository"))
map))
(defalias 'vc-menu-map vc-menu-map)