emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/project b3cc9f0 2/5: project-try-vc: Integrate wit


From: Dmitry Gutov
Subject: [Emacs-diffs] scratch/project b3cc9f0 2/5: project-try-vc: Integrate with VC
Date: Wed, 08 Jul 2015 13:02:36 +0000

branch: scratch/project
commit b3cc9f09be5f08dfc6c765c9924c367f25e6b5ef
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    project-try-vc: Integrate with VC
---
 lisp/progmodes/project.el |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index b18d65d..cfb7926 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -59,14 +59,11 @@ roots of any currently open related projects (if they're 
meant to
 be edited together).  The directory names should be absolute."
   (list (project-root project)))
 
-(defvar project-vc-root-files '(".git" ".hg" ".bzr"))
-
 (defun project-try-vc (dir)
-  (let* ((fun (lambda (dir)
-                (let ((default-directory dir))
-                  (cl-some #'file-exists-p project-vc-root-files))))
-         (root (locate-dominating-file dir fun)))
-    (when root (cons 'vc root))))
+  (let* ((backend (vc-responsible-backend dir))
+         (root (and backend (ignore-errors
+                              (vc-call-backend backend 'root dir)))))
+    (and root (cons 'vc root))))
 
 (cl-defmethod project-root ((project (head vc)))
   (cdr project))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]