From: Juri Linkov Date: Sun, 29 Mar 2020 00:08:05 +0000 (+0200) Subject: * lisp/vc/vc-dir.el (vc-dir-root): New command (bug#12492, bug#34949). X-Git-Tag: emacs-28.0.90~7697 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=52fab66c277cd8d83fad0bd6bda8234e102bdc02;p=emacs.git * 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'. --- diff --git a/etc/NEWS b/etc/NEWS index 870d39f7eef..4b477e5def6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 --- diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 38b4937e854..b760e170676 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -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 diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 345a28d3f1d..2ca9d3e620c 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -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)