[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41821: 28.0.50; read-directory-name in vc commands should provide de
From: |
Dmitry Gutov |
Subject: |
bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects |
Date: |
Sat, 20 Jun 2020 04:35:40 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
On 19.06.2020 02:28, Juri Linkov wrote:
Maybe something like:
Not too bad.
Though I'd rather not extend the public contract of project.el with a
function that special-cases VC projects.
So maybe something like this instead:
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9b12d44978..19a4c7f60d 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2508,6 +2508,19 @@ vc-print-log
)
(vc-print-log-internal backend files working-revision nil limit)))
+;; Or use project-try-vc after all. But this should be faster in the
+;; event when there actually are non-VC based projects in the list.
+(defun vc--known-vc-roots ()
+ (require 'project)
+ (defvar project--list)
+ (project--ensure-read-project-list)
+ (seq-filter (lambda (dir)
+ (let ((backend (vc-responsible-backend dir)))
+ (if backend
+ (condition-case nil
+ (vc-call-backend backend 'root dir)
+ (vc-not-supported
+ nil)))))
+ (mapcar #'car project--list)))
+
;;;###autoload
(defun vc-print-root-log (&optional limit revision)
"List the revision history for the current VC controlled tree in a
window.
@@ -2547,7 +2560,9 @@ 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
+ (vc--known-vc-roots)))
(setq backend (vc-responsible-backend rootdir))
(unless backend
(error "Directory is not version controlled")))
Personally, though, when I want behavior like this, I would probably
just type 'C-x p v'.
The directory name reading with completion performed by
project-prompt-project-dir is more quick and handy (though I'll confess
to using Ivy as the completion UI for this and one other function;
vertical completion fits these long string values best).
It also puts the selected project on the top of the list, which
vc--known-vc-roots (or your function) don't do.
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Juri Linkov, 2020/06/11
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Dmitry Gutov, 2020/06/12
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Juri Linkov, 2020/06/18
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects,
Dmitry Gutov <=
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Juri Linkov, 2020/06/20
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Dmitry Gutov, 2020/06/20
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Juri Linkov, 2020/06/21
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Dmitry Gutov, 2020/06/21
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Juri Linkov, 2020/06/22
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Dmitry Gutov, 2020/06/22
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Juri Linkov, 2020/06/23
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Eli Zaretskii, 2020/06/24
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Basil L. Contovounesios, 2020/06/24
- bug#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects, Eli Zaretskii, 2020/06/24