about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-10T16·44+0300
committerclbot <clbot@tvl.fyi>2022-08-10T16·48+0000
commit8f4beaaba269c3312c149fcb05414fdb8f7bdcae (patch)
tree5836041a32e828772b7e9976d5aa1c816c92d961
parent4732603a42c76ea53ab6a4d7358380f4d0194c48 (diff)
feat(tazjin/emacs): add helper function for navigating tvix tests r/4397
the upstream Nix test suite uses the pattern of having `.nix` and
`.exp` files for input/expected output, and with this shitty function
navigating between them is a lot simpler

Change-Id: I9d91290057521fe1e1599f69fd6b0f35e1b59960
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6058
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
-rw-r--r--users/tazjin/emacs/config/functions.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el
index 602809138e..e725c23ccf 100644
--- a/users/tazjin/emacs/config/functions.el
+++ b/users/tazjin/emacs/config/functions.el
@@ -340,4 +340,15 @@ the GPG agent correctly."
   (interactive)
   (zoxide-open-with nil #'magit-status-setup-buffer))
 
+(defun toggle-nix-test-and-exp ()
+  "Switch between the .nix and .exp file in a Tvix/Nix test."
+  (interactive)
+  (let* ((file (buffer-file-name))
+         (other (if (s-suffix? ".nix" file)
+                    (s-replace-regexp ".nix$" ".exp" file)
+                  (if (s-suffix? ".exp" file)
+                      (s-replace-regexp ".exp$" ".nix" file)
+                    (error "Not a .nix/.exp file!")))))
+    (find-file other)))
+
 (provide 'functions)