about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-05-17 15:57:02 +0100
committerDavid Morgan <djm_uk@protonmail.com>2022-05-17 15:57:02 +0100
commit419ec25a2515b4971a09b17ab04881a74cb9ed69 (patch)
tree49240a08c4074c306ead9e09bcb2c6b1bd2309d9
parentfe29ee35fb302fa587791848afdacd22f4064243 (diff)
downloaddotfiles-419ec25a2515b4971a09b17ab04881a74cb9ed69.tar.gz
Try out project-rootfile
-rw-r--r--.emacs.d/lisp/init-project.el22
1 files changed, 14 insertions, 8 deletions
diff --git a/.emacs.d/lisp/init-project.el b/.emacs.d/lisp/init-project.el
index 0611b71..bacf4ac 100644
--- a/.emacs.d/lisp/init-project.el
+++ b/.emacs.d/lisp/init-project.el
@@ -48,21 +48,27 @@
   (add-to-list 'project-switch-commands '(?m "Magit" magit-status) t)
   (add-to-list 'project-switch-commands '(?q "Replace Regexp" project-query-replace-regexp) t)
 
+  ;; TODO remove this when happy with project-rootfile
   ;; project-root and project-try-local copied/modified from https://github.com/karthink/project-x/blob/master/project-x.el
-  (cl-defmethod project-root ((project (head local)))
-    "Return root directory of current PROJECT."
-    (cdr project))
-  (defun project-try-local (dir)
-    "Treat DIR as a project if it contains a .project file."
-    (if-let ((root (locate-dominating-file dir ".project")))
-        (cons 'local root)))
+  ;; (cl-defmethod project-root ((project (head local)))
+  ;;   "Return root directory of current PROJECT."
+  ;;   (cdr project))
+  ;; (defun project-try-local (dir)
+  ;;   "Treat DIR as a project if it contains a .project file."
+  ;;   (if-let ((root (locate-dominating-file dir ".project")))
+  ;;       (cons 'local root)))
   ;; Add this hook last so so that vc takes precedence over local
-  (add-hook 'project-find-functions 'project-try-local 90)
+  ;;(add-hook 'project-find-functions 'project-try-local 90)
   :bind
   ("C-x p P" . project-switch-src-project)
   ("C-x p M-p" . project-switch-project)
   ("C-x f" . project-recentf))
 
+(use-package project-rootfile
+  :after project
+  :config
+  (add-to-list 'project-find-functions #'project-rootfile-try-detect t))
+
 (use-package perspective
   ;; Don't restart persp-mode when re-evaluating, as it clears the current persp list
   :init (or persp-mode (persp-mode))