[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 52fab66: * lisp/vc/vc-dir.el (vc-dir-root): New command (bug#1249

From: Juri Linkov
Subject: master 52fab66: * lisp/vc/vc-dir.el (vc-dir-root): New command (bug#12492, bug#34949).
Date: Sat, 28 Mar 2020 20:08:15 -0400 (EDT)

branch: master
commit 52fab66c277cd8d83fad0bd6bda8234e102bdc02
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * 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'.
 etc/NEWS            |  4 ++++
 lisp/vc/vc-dir.el   | 12 +++++++++++-
 lisp/vc/vc-hooks.el |  6 +++---
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 870d39f..4b477e5 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 38b4937..b760e17 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1287,6 +1287,16 @@ state of item at point, if any."
     (list vc-dir-backend files only-files-list state model)))
+(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))))
 (defun vc-dir (dir &optional backend)
   "Show the VC status for \"interesting\" files in and below DIR.
 This allows you to mark files and perform VC operations on them.
@@ -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 345a28d..2ca9d3e 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"))
 (defalias 'vc-menu-map vc-menu-map)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]