Last active
December 11, 2015 08:18
-
-
Save rsslldnphy/4572207 to your computer and use it in GitHub Desktop.
Emacs function to help create a TDD loop when writing SML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun restart-sml () | |
(sml-prog-proc-switch-to) | |
(end-of-buffer) | |
(comint-delchar-or-maybe-eof 0)) | |
(defun run-sml-tests-now () | |
(let* ((code-file-name | |
(replace-regexp-in-string "_tests" "" (buffer-file-name))) | |
(test-file-name | |
(replace-regexp-in-string "\.sml" "_tests.sml" code-file-name))) | |
(sml-mode) | |
(sml-prog-proc-load-file code-file-name) | |
(sml-prog-proc-load-file test-file-name) | |
(windmove-up))) | |
(defun run-sml-tests () | |
(interactive) | |
(restart-sml) | |
(windmove-up) | |
(run-with-idle-timer 0.5 nil 'run-sml-tests-now)) | |
(global-set-key (kbd "C-c C-t") 'run-sml-tests) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks it will be really useful for me!