aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Gutov2023-02-18 00:50:29 +0200
committerDmitry Gutov2023-02-18 00:54:39 +0200
commit18e96ed7c8a388d5aee4be37c8f268fb826fc1d2 (patch)
treeab9c2c2132951c6a9bac0520d04f226d716f2133
parent0a5615669a4f5d7e2db3c4117f3c2440e9c4cfd5 (diff)
downloademacs-18e96ed7c8a388d5aee4be37c8f268fb826fc1d2.tar.gz
emacs-18e96ed7c8a388d5aee4be37c8f268fb826fc1d2.zip
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).
-rw-r--r--lisp/progmodes/project.el28
1 files 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.
494The directory names should be absolute. Used in the VC-aware 494The directory names should be absolute. Used in the VC-aware
495project backend implementation of `project-external-roots'.") 495project backend implementation of `project-external-roots'.")
496 496
497(defvar project-vc-backend-markers-alist
498 `((Git . ".git")
499 (Hg . ".hg")
500 (Bzr . ".bzr")
501 ;; See the comment above `vc-svn-admin-directory' for why we're
502 ;; duplicating the definition.
503 (SVN . ,(if (and (memq system-type '(cygwin windows-nt ms-dos))
504 (getenv "SVN_ASP_DOT_NET_HACK"))
505 "_svn"
506 ".svn"))
507 (DARCS . "_darcs")
508 (Fossil . ".fslckout"))
509 "Associative list assigning root markers to VC backend symbols.
510
511See `project-vc-extra-root-markers' for the marker value format.")
512
497(defun project-try-vc (dir) 513(defun project-try-vc (dir)
498 (defvar vc-svn-admin-directory) 514 (defvar vc-svn-admin-directory)
499 (require 'vc-svn) 515 (require 'vc-svn)
@@ -501,17 +517,11 @@ project backend implementation of `project-external-roots'.")
501 ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers' 517 ;; `project-vc-merge-submodules' or `project-vc-extra-root-markers'
502 ;; changes. 518 ;; changes.
503 (or (vc-file-getprop dir 'project-vc) 519 (or (vc-file-getprop dir 'project-vc)
504 (let* ((backend-markers-alist `((Git . ".git") 520 (let* ((backend-markers
505 (Hg . ".hg")
506 (Bzr . ".bzr")
507 (SVN . ,vc-svn-admin-directory)
508 (DARCS . "_darcs")
509 (Fossil . ".fslckout")))
510 (backend-markers
511 (delete 521 (delete
512 nil 522 nil
513 (mapcar 523 (mapcar
514 (lambda (b) (assoc-default b backend-markers-alist)) 524 (lambda (b) (assoc-default b project-vc-backend-markers-alist))
515 vc-handled-backends))) 525 vc-handled-backends)))
516 (marker-re 526 (marker-re
517 (concat 527 (concat
@@ -537,7 +547,7 @@ project backend implementation of `project-external-roots'.")
537 (backend 547 (backend
538 (cl-find-if 548 (cl-find-if
539 (lambda (b) 549 (lambda (b)
540 (member (assoc-default b backend-markers-alist) 550 (member (assoc-default b project-vc-backend-markers-alist)
541 last-matches)) 551 last-matches))
542 vc-handled-backends)) 552 vc-handled-backends))
543 project) 553 project)