From: joaotavora@gmail.com (João Távora)
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Dan Nicolaescu <dann@gnu.org>,
Daniel Colascione <dancol@dancol.org>,
Stefan Monnier <monnier@iro.umontreal.ca>,
Emacs developers <emacs-devel@gnu.org>
Subject: Re: vc-dir default directory: repository root?
Date: Thu, 22 Jan 2015 12:40:20 +0000 [thread overview]
Message-ID: <m2mw5b7zuz.fsf@king.lan> (raw)
In-Reply-To: <54C00C68.4010204@yandex.ru> (Dmitry Gutov's message of "Wed, 21 Jan 2015 22:30:32 +0200")
Dmitry Gutov <dgutov@yandex.ru> writes:
> On 01/21/2015 10:14 PM, joaotavora@gmail.com (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
next prev parent reply other threads:[~2015-01-22 12:40 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-10 6:52 vc-dir default directory: repository root? Daniel Colascione
2015-01-11 1:26 ` Stefan Monnier
2015-01-11 8:33 ` Andreas Schwab
2015-01-11 15:53 ` Wolfgang Jenkner
2015-01-11 19:02 ` Dan Nicolaescu
2015-01-19 1:40 ` Dmitry Gutov
2015-01-19 15:47 ` Dan Nicolaescu
2015-01-19 23:17 ` Dmitry Gutov
2015-01-20 20:06 ` Dan Nicolaescu
2015-01-21 14:33 ` Stefan Monnier
2015-01-21 16:20 ` Ivan Shmakov
2015-01-21 17:33 ` Dan Nicolaescu
2015-01-21 17:48 ` Dmitry Gutov
2015-01-21 18:22 ` Ivan Shmakov
2015-01-21 18:43 ` Dmitry Gutov
2015-01-21 19:22 ` Ivan Shmakov
2015-01-21 18:47 ` João Távora
2015-01-21 19:06 ` Dmitry Gutov
2015-01-21 20:14 ` João Távora
2015-01-21 20:30 ` Dmitry Gutov
2015-01-22 12:40 ` João Távora [this message]
2015-01-22 15:19 ` Dan Nicolaescu
2015-01-21 19:35 ` Wolfgang Jenkner
2015-01-21 19:42 ` Daniel Colascione
2015-01-21 20:16 ` Stefan Monnier
2015-01-22 9:59 ` Daniel Colascione
2015-01-22 1:44 ` Dmitry Gutov
2015-01-22 9:17 ` Andreas Schwab
2015-01-22 11:14 ` Dmitry Gutov
2015-01-22 12:04 ` Jan D.
2015-01-22 14:18 ` Stefan Monnier
2015-01-22 14:23 ` Dmitry Gutov
2015-01-22 14:38 ` Andreas Schwab
2015-01-22 14:46 ` Dmitry Gutov
2015-01-22 15:30 ` Drew Adams
2015-01-22 16:16 ` Dmitry Gutov
2015-01-22 15:40 ` Andreas Schwab
2015-01-22 14:45 ` Ivan Shmakov
2015-01-22 14:49 ` Dmitry Gutov
2015-01-22 15:50 ` Ivan Shmakov
2015-01-22 16:26 ` Dmitry Gutov
2015-01-22 16:11 ` Wolfgang Jenkner
2015-01-19 1:38 ` Dmitry Gutov
2015-01-19 3:01 ` Stefan Monnier
2015-01-19 4:54 ` Dmitry Gutov
2015-01-19 14:16 ` Stefan Monnier
2015-01-19 14:55 ` Dmitry Gutov
2015-01-19 14:57 ` Daniel Colascione
2015-01-19 22:43 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2mw5b7zuz.fsf@king.lan \
--to=joaotavora@gmail.com \
--cc=dancol@dancol.org \
--cc=dann@gnu.org \
--cc=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).