[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vc-dir default directory: repository root?
From: |
João Távora |
Subject: |
Re: vc-dir default directory: repository root? |
Date: |
Thu, 22 Jan 2015 12:40:20 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (darwin) |
Dmitry Gutov <address@hidden> writes:
> On 01/21/2015 10:14 PM, address@hidden (João Távora) wrote:
>
>> But then, isn't this an argument for following Git's default
>> behaviour of using the root dir??
>
> One can look at it in different ways, but I consider it an argument
> against CVS and SVN being special snowflakes.
How so? If the default behaviour of "svn status" and "git status"
differ, shouldn't vc-dir follow those defaults according to the backend,
so that it does-what-we-mean with a better chance? Isn't DWIM the idea
behind other commands like `vc-next-action` and such?
Wouldn't this appease the people who oppose this change because they use
CVS/SVN? Attached is a (slightly untested) patch to do this, in case I
am not making myself clear.
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index c1d32ce..e75dcb3 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -770,6 +770,10 @@ If UPDATE is non-nil, then update (resynch) any affected
buffers."
(re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
\\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t)))
+(defun vc-cvs-default-status-dir ()
+ "For CVS, `vc-dir' should default to the current directory"
+ default-directory)
+
;;;
;;; Internal functions
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index c90bf1c..0644909 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1215,6 +1215,17 @@ 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)))
+(defun vc-dir-default-status-dir ()
+ "Provide a good default value for `vc-dir' prompt.
+Defaults to `vc-root-dir' if the backend doesn't implement this function."
+ (let ((backend (vc-deduce-backend)))
+ (if backend
+ (condition-case _err
+ (vc-call-backend backend 'default-status-dir)
+ (error
+ (vc-root-dir)))
+ (vc-root-dir))))
+
;;;###autoload
(defun vc-dir (dir &optional backend)
"Show the VC status for \"interesting\" files in and below DIR.
@@ -1241,7 +1252,7 @@ These are the commands available for use in the file
status buffer:
;; 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: "
- default-directory default-directory t
+ (vc-dir-default-status-dir) nil t
nil))
(if current-prefix-arg
(intern
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 5c87cab..80b12ea 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -256,6 +256,10 @@ RESULT is a list of conses (FILE . STATE) for directory
DIR."
newrev)
(number-to-string newrev))))
+(defun vc-svn-default-status-dir ()
+ "For SVN, `vc-dir' should default to the current directory"
+ default-directory)
+
;;;
;;; State-changing functions
- Re: vc-dir default directory: repository root?, (continued)
- Re: vc-dir default directory: repository root?, Ivan Shmakov, 2015/01/21
- Re: vc-dir default directory: repository root?, Dan Nicolaescu, 2015/01/21
- Re: vc-dir default directory: repository root?, Dmitry Gutov, 2015/01/21
- Re: vc-dir default directory: repository root?, Ivan Shmakov, 2015/01/21
- Re: vc-dir default directory: repository root?, Dmitry Gutov, 2015/01/21
- Re: vc-dir default directory: repository root?, Ivan Shmakov, 2015/01/21
- Re: vc-dir default directory: repository root?, João Távora, 2015/01/21
- Re: vc-dir default directory: repository root?, Dmitry Gutov, 2015/01/21
- Re: vc-dir default directory: repository root?, João Távora, 2015/01/21
- Re: vc-dir default directory: repository root?, Dmitry Gutov, 2015/01/21
- Re: vc-dir default directory: repository root?,
João Távora <=
- Re: vc-dir default directory: repository root?, Dan Nicolaescu, 2015/01/22
- Re: vc-dir default directory: repository root?, Wolfgang Jenkner, 2015/01/21
- Re: vc-dir default directory: repository root?, Daniel Colascione, 2015/01/21
- Re: vc-dir default directory: repository root?, Stefan Monnier, 2015/01/21
- Re: vc-dir default directory: repository root?, Daniel Colascione, 2015/01/22
- Re: vc-dir default directory: repository root?, Dmitry Gutov, 2015/01/21
- Re: vc-dir default directory: repository root?, Andreas Schwab, 2015/01/22
- Re: vc-dir default directory: repository root?, Dmitry Gutov, 2015/01/22
- Re: vc-dir default directory: repository root?, Jan D., 2015/01/22
- Re: vc-dir default directory: repository root?, Stefan Monnier, 2015/01/22