From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: vc-dir default directory: repository root? Date: Thu, 22 Jan 2015 12:40:20 +0000 Message-ID: References: <54B0CC33.2050100@dancol.org> <54BC60A8.6040401@yandex.ru> <54BD9071.5070802@yandex.ru> <54BFE680.9000109@yandex.ru> <54BFF89D.1060109@yandex.ru> <54C00C68.4010204@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1421930464 2037 80.91.229.3 (22 Jan 2015 12:41:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Jan 2015 12:41:04 +0000 (UTC) Cc: Dan Nicolaescu , Daniel Colascione , Stefan Monnier , Emacs developers To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 22 13:40:59 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YEH4E-0006MR-4E for ged-emacs-devel@m.gmane.org; Thu, 22 Jan 2015 13:40:58 +0100 Original-Received: from localhost ([::1]:52888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEH4D-0004xZ-DT for ged-emacs-devel@m.gmane.org; Thu, 22 Jan 2015 07:40:57 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEH3p-0004xR-0e for emacs-devel@gnu.org; Thu, 22 Jan 2015 07:40:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEH3j-0000o9-P0 for emacs-devel@gnu.org; Thu, 22 Jan 2015 07:40:32 -0500 Original-Received: from mail-we0-x231.google.com ([2a00:1450:400c:c03::231]:51900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEH3j-0000lY-HQ; Thu, 22 Jan 2015 07:40:27 -0500 Original-Received: by mail-we0-f177.google.com with SMTP id l61so1493506wev.8; Thu, 22 Jan 2015 04:40:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=fm7UjRU27eTTnxLsOcnwaIMPG4KIMUw3QhqilMT4YGQ=; b=eSB41U41Egl3Y1boCLxcW8IafhuJXO6B2JQ2R6VWIXDuOYlDHvKaZ1IlNKq56woBJN bHTVYII9FlcZCwp8rCaFVUzoSIUkB7Pi8hBHnhC+5UbSoV4c18yDpWSQtOphEOlsRv37 MbP2CrPWxrCG3uA62M8C8lbIWTEh+zmBmaHuWY9XOORBBrBOPMsFejkiXjDC3u1YYy1Z baG9y9nHoFRKGji/zzwQKFMYiaPLv5qrezSss377SgUbw7P2jfNUESUCBRjq9xuwoNII /tu8bXdEwxCehBGNa7zNeFB464hCivrh4upTOREVtsSRpbysl8ocu10tEI7ilJWOyT93 3jcQ== X-Received: by 10.180.210.167 with SMTP id mv7mr66023774wic.78.1421930426803; Thu, 22 Jan 2015 04:40:26 -0800 (PST) Original-Received: from king.lan.yourcompany.com (31.57.37.188.rev.vodafone.pt. [188.37.57.31]) by mx.google.com with ESMTPSA id c10sm3844272wjy.4.2015.01.22.04.40.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2015 04:40:25 -0800 (PST) In-Reply-To: <54C00C68.4010204@yandex.ru> (Dmitry Gutov's message of "Wed, 21 Jan 2015 22:30:32 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (darwin) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181590 Archived-At: Dmitry Gutov writes: > On 01/21/2015 10:14 PM, joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) wrot= e: > >> 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 affect= ed buffers." (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\ \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t))) =20 +(defun vc-cvs-default-status-dir () + "For CVS, `vc-dir' should default to the current directory" + default-directory) + =20 ;;; ;;; 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))) =20 +(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 director= y DIR." newrev) (number-to-string newrev)))) =20 +(defun vc-svn-default-status-dir () + "For SVN, `vc-dir' should default to the current directory" + default-directory) + =20 ;;; ;;; State-changing functions