feat(tazjin/emacs): add helper function for navigating tvix tests

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
This commit is contained in:
Vincent Ambo 2022-08-10 19:44:55 +03:00 committed by clbot
parent 4732603a42
commit 8f4beaaba2

View file

@ -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)