about summary refs log tree commit diff
path: root/users/tazjin
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2023-08-04T16·31+0300
committerclbot <clbot@tvl.fyi>2023-08-04T16·35+0000
commit261ae2de950b319b47f2bd259de23310269c5fed (patch)
treeefeec50ab9e775b75e19d18a95fd98b504d51110 /users/tazjin
parent1b84ac5f3158a3cd81214d1e5337ea002a817c8d (diff)
feat(tazjin/emacs): make zoxide project opener work without git r/6462
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 <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users/tazjin')
-rw-r--r--users/tazjin/emacs/config/bindings.el4
-rw-r--r--users/tazjin/emacs/config/functions.el10
2 files changed, 9 insertions, 5 deletions
diff --git a/users/tazjin/emacs/config/bindings.el b/users/tazjin/emacs/config/bindings.el
index 1feb9faf8186..85643657010b 100644
--- a/users/tazjin/emacs/config/bindings.el
+++ b/users/tazjin/emacs/config/bindings.el
@@ -49,8 +49,8 @@
 ;; Open the depot
 (global-set-key (kbd "s-s d") #'tvl-depot-status)
 
-;; Open any repo through zoxide
-(global-set-key (kbd "s-s r") #'zoxide-open-magit)
+;; Open any project through zoxide
+(global-set-key (kbd "s-s r") #'zoxide-open-project)
 
 ;; Add subthread collapsing to notmuch-show.
 ;;
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."