Commit c7cf5cc4e59e
Changed files (1)
tools
emacs
config
tools/emacs/config/config-projects.el
@@ -1,14 +1,31 @@
;;; config-projects.el --- -*- lexical-binding: t; -*-
;;; Commentary:
;;; Project related configuration.
-;;; This is mainly using projectile now, but built-in projects module seems promising for long-term.
-;;; Note: this file is autogenerated from an org-mode file.
;;; Code:
-
(use-package project
:bind (("C-x p v" . vde-project-magit-status)
("C-x p s" . vde-project-vterm))
+ :config
+
+ (setq vde/project-local-identifier '(".project" "go.mod" "Cargo.toml"
+ "Makefile" "README.org" "README.md"))
+
+ (defun vde/project-try-local (dir)
+ "Determine if DIR is a non-VC project."
+ (if-let ((root (if (listp vde/project-local-identifier)
+ (seq-some (lambda (n)
+ (locate-dominating-file dir n))
+ vde/project-local-identifier)
+ (locate-dominating-file dir vde/project-local-identifier))))
+ (cons 'local root)))
+ (cl-defmethod project-root ((project (head local)))
+ (cdr project))
+
+ (cl-defmethod project-root ((project (eql nil))) nil)
+
+ (add-hook 'project-find-functions #'vde/project-try-local)
+
:init
(setq-default project-compilation-buffer-name-function 'project-prefixed-buffer-name)
(defun vde-project-magit-status ()