emacs-devel
[Top][All Lists]
Advanced

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

Re: vc-dir default directory: repository root?


From: Daniel Colascione
Subject: Re: vc-dir default directory: repository root?
Date: Thu, 22 Jan 2015 01:59:30 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 01/21/2015 12:16 PM, Stefan Monnier wrote:
>> That seems like it'd confuse users. Are we okay with just repurposing
>> the prefix argument?
> 
> Fine by me.

I like the idea of using prefix argument repetition to select the
arguments for which we'd like to prompt. How's this?

diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index e050c94..c5fbcf6 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1227,7 +1227,10 @@ first appears, it has only the first few lines of
summary information.
 The file lines appear later.

 Optional second argument BACKEND specifies the VC backend to use.
-Interactively, a prefix argument means to ask for the backend.
+Interactively, display the repository root.  A single prefix
+argument means to ask for the root directory, defaulting to
+`default-directory'.  A duplicated default prefix argument (e.g.,
+C-u C-u) means to ask for the VC back-end as well.

 These are the commands available for use in the file status buffer:

@@ -1240,16 +1243,20 @@ These are the commands available for use in the
file status buffer:
     ;; therefore it makes sense to always do that.
     ;; Otherwise if you do C-x v d -> C-x C-f -> C-c 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
-                                       nil))
     (if current-prefix-arg
-       (intern
-        (completing-read
-         "Use VC backend: "
-         (mapcar (lambda (b) (list (symbol-name b)))
-                 vc-handled-backends)
-         nil t nil nil)))))
+        (file-truename (read-directory-name "VC status for directory: "
+                                            default-directory
default-directory t
+                                            nil))
+      (vc-root-dir))
+    (when (and (consp current-prefix-arg)
+               (null (cdr current-prefix-arg))
+               (> (car current-prefix-arg) 4))
+      (intern
+       (completing-read
+        "Use VC backend: "
+        (mapcar (lambda (b) (list (symbol-name b)))
+                vc-handled-backends)
+        nil t nil nil)))))
   (unless backend
     (setq backend (vc-responsible-backend dir)))
   (let (pop-up-windows)                      ; based on cvs-examine; bug#6204


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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