about summary refs log tree commit diff
path: root/users/tazjin/emacs/config/functions.el
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/emacs/config/functions.el')
-rw-r--r--users/tazjin/emacs/config/functions.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el
index 39334c95a509..835b4e44d518 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."