From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail
From: Juri Linkov <juri@linkov.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#41821: 28.0.50;
 read-directory-name in vc commands should provide defaults from
 projects
Date: Fri, 19 Jun 2020 02:28:17 +0300
Organization: LINKOV.NET
Message-ID: <87mu50j5cu.fsf@mail.linkov.net>
References: <87r1ulxk48.fsf@mail.linkov.net>
 <7164426e-8c37-8839-64da-563cfa829b53@yandex.ru>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202";
	logging-data="119460"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
Cc: 41821@debbugs.gnu.org
To: Dmitry Gutov <dgutov@yandex.ru>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 19 01:58:11 2020
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1jm4Q5-000V0k-BN
	for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Jun 2020 01:58:09 +0200
Original-Received: from localhost ([::1]:35008 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1jm4Q4-00073F-72
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 Jun 2020 19:58:08 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46266)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1jm4Py-00072T-9y
 for bug-gnu-emacs@gnu.org; Thu, 18 Jun 2020 19:58:02 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:43134)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1jm4Py-0005iB-1E
 for bug-gnu-emacs@gnu.org; Thu, 18 Jun 2020 19:58:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1jm4Py-0007Dt-0O
 for bug-gnu-emacs@gnu.org; Thu, 18 Jun 2020 19:58:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Juri Linkov <juri@linkov.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 18 Jun 2020 23:58:01 +0000
Resent-Message-ID: <handler.41821.B41821.159252466027736@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 41821
X-GNU-PR-Package: emacs
Original-Received: via spool by 41821-submit@debbugs.gnu.org id=B41821.159252466027736
 (code B ref 41821); Thu, 18 Jun 2020 23:58:01 +0000
Original-Received: (at 41821) by debbugs.gnu.org; 18 Jun 2020 23:57:40 +0000
Original-Received: from localhost ([127.0.0.1]:54680 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1jm4Pc-0007DI-AM
 for submit@debbugs.gnu.org; Thu, 18 Jun 2020 19:57:40 -0400
Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:46361)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@linkov.net>) id 1jm4PX-0007D1-BW
 for 41821@debbugs.gnu.org; Thu, 18 Jun 2020 19:57:38 -0400
X-Originating-IP: 91.129.108.6
Original-Received: from mail.gandi.net (m91-129-108-6.cust.tele2.ee [91.129.108.6])
 (Authenticated sender: juri@linkov.net)
 by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 208A060005;
 Thu, 18 Jun 2020 23:57:27 +0000 (UTC)
In-Reply-To: <7164426e-8c37-8839-64da-563cfa829b53@yandex.ru> (Dmitry Gutov's
 message of "Fri, 12 Jun 2020 16:43:48 +0300")
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "bug-gnu-emacs"
 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.bugs:182162
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/182162>

--=-=-=
Content-Type: text/plain

>> For example, typing 'C-x v L' (vc-print-root-log) outside of a project
>> displays the minibuffer with the prompt "Directory for VC revision log: ".
>> It should provide a list of the default values from the project list
>> saved in ~/.emacs.d/projects
>
> Note that one would have to verify that each directory in the list is
> a part of a VC repository.

Maybe something like:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=project-vc-list.patch

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 7a41df614b..fcba4136b0 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -897,6 +897,12 @@ project-prompt-project-dir
         (read-directory-name "Select directory: " default-directory nil t)
       pr-dir)))
 
+;;;###autoload
+(defun project-vc-list ()
+  "Return a list of VC-based projects."
+  (project--ensure-read-project-list)
+  (seq-filter #'project-try-vc (mapcar #'car project--list)))
+
 
 ;;; Project switching
 
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 08b1a85c9b..a640067de1 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2559,7 +2559,8 @@ vc-print-root-log
 	 rootdir)
     (if backend
 	(setq rootdir (vc-call-backend backend 'root default-directory))
-      (setq rootdir (read-directory-name "Directory for VC revision log: "))
+      (setq rootdir (read-directory-name "Directory for VC revision log: " nil
+                                         (project-vc-list)))
       (setq backend (vc-responsible-backend rootdir))
       (unless backend
         (error "Directory is not version controlled")))

--=-=-=--