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:
parent
4732603a42
commit
8f4beaaba2
1 changed files with 11 additions and 0 deletions
|
@ -340,4 +340,15 @@ the GPG agent correctly."
|
||||||
(interactive)
|
(interactive)
|
||||||
(zoxide-open-with nil #'magit-status-setup-buffer))
|
(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)
|
(provide 'functions)
|
||||||
|
|
Loading…
Reference in a new issue