diff options
author | William Carroll <wpcarro@gmail.com> | 2020-09-06T17·20+0100 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-09-06T17·20+0100 |
commit | 43fc1d93fb1151c9efafece3084cfdc6bf5e03e1 (patch) | |
tree | 86be9af3806428702ed40e4267414631516dffd7 /emacs/.emacs.d/wpc/wpc-misc.el | |
parent | 5cf6a0b23da854d10a37eb84e7eff1557da51daa (diff) |
Prefer 'vc as the project-find-file type when at briefcase's root
See the explanatory comment that I left in the code.
Diffstat (limited to 'emacs/.emacs.d/wpc/wpc-misc.el')
-rw-r--r-- | emacs/.emacs.d/wpc/wpc-misc.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/emacs/.emacs.d/wpc/wpc-misc.el b/emacs/.emacs.d/wpc/wpc-misc.el index 1dda82005efc..bdb504760ea7 100644 --- a/emacs/.emacs.d/wpc/wpc-misc.el +++ b/emacs/.emacs.d/wpc/wpc-misc.el @@ -215,10 +215,16 @@ ;; TODO: Consider moving this into a briefcase.el module. (defun wpc-misc--briefcase-find (dir) "Find the default.nix nearest to DIR." - (when (s-starts-with? constants-briefcase (f-expand dir)) - (if (f-exists? (f-join dir "default.nix")) - (cons 'transient dir) - (wpc-misc--briefcase-find (f-parent dir))))) + ;; I use 'vc only at the root of my monorepo because 'transient doesn't use my + ;; .gitignore, which slows things down. Ideally, I could write a version that + ;; behaves like 'transient but also respects my monorepo's .gitignore and any + ;; ancestor .gitignore files. + (if (f-equal? constants-briefcase dir) + (cons 'vc dir) + (when (f-parent-of? constants-briefcase dir) + (if (f-exists? (f-join dir "default.nix")) + (cons 'transient dir) + (wpc-misc--briefcase-find (f-parent dir)))))) (add-to-list 'project-find-functions #'wpc-misc--briefcase-find) |