From 18e96ed7c8a388d5aee4be37c8f268fb826fc1d2 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 18 Feb 2023 00:50:29 +0200 Subject: [PATCH] project.el: Extract backend->marker association for a defvar * lisp/progmodes/project.el (project-vc-backend-markers-alist): Extract from 'project-try-vc'. (project-try-vc): Update accordingly (bug#61577). --- lisp/progmodes/project.el | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 2343adf4698..46bafc55777 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -494,6 +494,22 @@ files related to the current buffer. The directory names should be absolute. Used in the VC-aware project backend implementation of `project-external-roots'.") +(defvar project-vc-backend-markers-alist + `((Git . ".git") + (Hg . ".hg") + (Bzr . ".bzr") + ;; See the comment above `vc-svn-admin-directory' for why we're + ;; duplicating the definition. + (SVN . ,(if (and (memq system-type '(cygwin windows-nt ms-dos)) + (getenv "SVN_ASP_DOT_NET_HACK")) + "_svn" + ".svn")) + (DARCS . "_darcs") + (Fossil . ".fslckout")) + "Associative list assigning root markers to VC backend symbols. + +See `project-vc-extra-root-markers' for the marker value format.") + (defun project-try-vc (dir) (defvar vc-svn-admin-directory) (require 'vc-svn) @@ -501,17 +517,11 @@ project backend implementation of `project-external-roots'.") ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers' ;; changes. (or (vc-file-getprop dir 'project-vc) - (let* ((backend-markers-alist `((Git . ".git") - (Hg . ".hg") - (Bzr . ".bzr") - (SVN . ,vc-svn-admin-directory) - (DARCS . "_darcs") - (Fossil . ".fslckout"))) - (backend-markers + (let* ((backend-markers (delete nil (mapcar - (lambda (b) (assoc-default b backend-markers-alist)) + (lambda (b) (assoc-default b project-vc-backend-markers-alist)) vc-handled-backends))) (marker-re (concat @@ -537,7 +547,7 @@ project backend implementation of `project-external-roots'.") (backend (cl-find-if (lambda (b) - (member (assoc-default b backend-markers-alist) + (member (assoc-default b project-vc-backend-markers-alist) last-matches)) vc-handled-backends)) project) -- 2.39.2