summaryrefslogtreecommitdiff
path: root/lisp/vc
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/vc')
-rw-r--r--lisp/vc/vc-dir.el7
-rw-r--r--lisp/vc/vc-hooks.el5
-rw-r--r--lisp/vc/vc.el10
3 files changed, 14 insertions, 8 deletions
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index a86c37c24ae..46be9b73801 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1366,7 +1366,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-x v d
;; you may get a new *vc-dir* buffer, different from the original
(file-truename (read-directory-name "VC status for directory: "
- (vc-root-dir) nil t
+ (vc-root-dir) (vc-known-roots) t
nil))
(if current-prefix-arg
(intern
@@ -1496,8 +1496,9 @@ This implements the `bookmark-make-record-function' type for
This implements the `handler' function interface for the record
type returned by `vc-dir-bookmark-make-record'."
(let* ((file (bookmark-prop-get bmk 'filename))
- (buf (save-window-excursion
- (vc-dir file) (current-buffer))))
+ (buf (progn ;; Don't use save-window-excursion (bug#39722)
+ (vc-dir file)
+ (current-buffer))))
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index ce72a49b955..46f55358de8 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -299,6 +299,11 @@ non-nil if FILE exists and its contents were successfully inserted."
(set-buffer-modified-p nil)
t))
+(declare-function project-try-vc "project")
+(defun vc-known-roots ()
+ "Return a list of known vc roots."
+ (seq-filter #'project-try-vc (project-known-project-roots)))
+
(defun vc-find-root (file witness)
"Find the root of a checked out project.
The function walks up the directory tree from FILE looking for WITNESS.
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9b12d449785..49323ef47d2 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1074,11 +1074,9 @@ BEWARE: this function may change the current buffer."
(progn ;FIXME: Why not `with-current-buffer'? --Stef.
(set-buffer vc-parent-buffer)
(vc-deduce-fileset not-state-changing allow-unregistered state-model-only-files)))
- ((and (derived-mode-p 'log-view-mode)
+ ((and (not buffer-file-name)
(setq backend (vc-responsible-backend default-directory)))
(list backend nil))
- ((not buffer-file-name)
- (error "Buffer %s is not associated with a file" (buffer-name)))
((and allow-unregistered (not (vc-registered buffer-file-name)))
(if state-model-only-files
(list (vc-backend-for-registration (buffer-file-name))
@@ -2003,7 +2001,8 @@ saving the buffer."
rootdir working-revision)
(if backend
(setq rootdir (vc-call-backend backend 'root default-directory))
- (setq rootdir (read-directory-name "Directory for VC root-diff: "))
+ (setq rootdir (read-directory-name "Directory for VC root-diff: "
+ nil (vc-known-roots)))
(setq backend (vc-responsible-backend rootdir))
(if backend
(setq default-directory rootdir)
@@ -2547,7 +2546,8 @@ with its diffs (if the underlying VCS supports that)."
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-roots)))
(setq backend (vc-responsible-backend rootdir))
(unless backend
(error "Directory is not version controlled")))