Skip to content

Instantly share code, notes, and snippets.

@rsslldnphy
Last active December 11, 2015 08:18
Show Gist options
  • Save rsslldnphy/4572207 to your computer and use it in GitHub Desktop.
Save rsslldnphy/4572207 to your computer and use it in GitHub Desktop.
Emacs function to help create a TDD loop when writing SML
(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)
@rmariuzzo
Copy link

Thanks it will be really useful for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment