From 937469509bfcef494ae1b1bc6ba23bfccd28d477 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 23 Aug 2020 22:39:42 +0100 Subject: feat(tazjin/emacs): Add depot-aware project.el extension If this ends up working well I'll extract it to tvl.el Change-Id: I83722abf33a3346ccc7957c8d64d6381b15c6ee9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1837 Tested-by: BuildkiteCI Reviewed-by: isomer --- users/tazjin/emacs/config/functions.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'users') diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index 6478f88cc1c8..df5b1c1239f0 100644 --- a/users/tazjin/emacs/config/functions.el +++ b/users/tazjin/emacs/config/functions.el @@ -40,8 +40,6 @@ (interactive) (man "configuration.nix")) -;; Open my monorepo in magit - ;; Get the nix store path for a given derivation. ;; If the derivation has not been built before, this will trigger a build. (defun nix-store-path (derivation) @@ -281,4 +279,14 @@ (interactive) (vterm-send-key "x" nil nil t)) +(defun find-depot-project (dir) + "Function used in the `project-find-functions' hook list to + determine the current project root of a depot project." + (when (s-starts-with? "/depot" dir) + (if (f-exists-p (f-join dir "default.nix")) + (cons 'transient dir) + (find-depot-project (f-parent dir))))) + +(add-to-list 'project-find-functions #'find-depot-project) + (provide 'functions) -- cgit 1.4.1