From d39d3b2d41d62464dfb819cd570561c0ff2b35ed Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Thu, 2 Nov 2023 21:38:31 -0700 Subject: [PATCH] Add non-vc backed project backend --- init.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index b92b9d3..7afc018 100644 --- a/init.el +++ b/init.el @@ -527,6 +527,8 @@ visual states." (stringp val))) (defvar my/-project-run-history '() "Commands previously run with `my/project-run'") + (defvar my/project-root-marker ".project-root" + "Marker file to look for in non-vc backed projects.") (defun my/project-get-root-dir () "Get the root dir for the current project" (let* ((proj (project-current nil)) @@ -559,7 +561,12 @@ COMMAND and COMINT are like `compile'." (compile-command nil)) (compile command comint) (when (not my/project-run-command) - (setq my/project-run-command command))))) + (setq my/project-run-command command)))) + :config + (defun my/project-try-dotfile (dir) + (if-let (root (locate-dominating-file dir my/project-root-marker)) + (list 'vc nil root))) + (add-hook 'project-find-functions #'my/project-try-dotfile)) ;; nxml (use-package nxml-mode