diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index 602809138..e725c23cc 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)