From: Dmitry Gutov Date: Fri, 17 Feb 2023 22:50:29 +0000 (+0200) Subject: project.el: Extract backend->marker association for a defvar X-Git-Tag: emacs-29.0.90~420 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=18e96ed7c8a;p=emacs.git 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). --- 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)