From 261ae2de950b319b47f2bd259de23310269c5fed Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 4 Aug 2023 19:31:45 +0300 Subject: feat(tazjin/emacs): make zoxide project opener work without git Work projects are not in git, but I still want to fuzzy jump to them. Change-Id: Iced78519da69b6992d253e2a0c9ed485f1347164 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9005 Reviewed-by: tazjin Tested-by: BuildkiteCI Autosubmit: tazjin --- users/tazjin/emacs/config/functions.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'users/tazjin/emacs/config/functions.el') diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index 39334c95a5..835b4e44d5 100644 --- a/users/tazjin/emacs/config/functions.el +++ b/users/tazjin/emacs/config/functions.el @@ -351,10 +351,14 @@ by looking for a `Cargo.toml' file." (if-let ((pr (project-current))) (project-root pr))))) -(defun zoxide-open-magit () - "Query Zoxide for paths and open magit in the result." +(defun zoxide-open-project () + "Query Zoxide for paths, and open the result as appropriate (magit or dired)." (interactive) - (zoxide-open-with nil #'magit-status-setup-buffer)) + (zoxide-open-with + nil + (lambda (path) + (condition-case err (magit-status-setup-buffer path) + (magit-outside-git-repo (dired path)))))) (defun toggle-nix-test-and-exp () "Switch between the .nix and .exp file in a Tvix/Nix test." -- cgit 1.4.1