Skip to content

Commit

Permalink
fix autotest mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dmh43 committed May 7, 2017
1 parent 10dce0b commit be8ecb5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions emacs-tertestrial.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"Emacs interface to Tertestrial"
:group 'tools)

(defvar tertestrial-auto-test-mode nil)
(defvar tertestrial-project-err-regexp-alist)
(defvar tertestrial-command "tertestrial")
(defvar node-err-regexp
Expand Down Expand Up @@ -223,18 +224,19 @@ https://github.com/abo-abo/swiper")))

(defun tertestrial-toggle-autotest-hook ()
(interactive)
(if (advice-member-p 'tertestrial-last-test 'save-buffer)
(if tertestrial-auto-test-mode
(progn
(advice-remove 'save-buffer 'tertestrial-last-test)
(setf tertestrial-auto-test-mode nil)
(message "Tertestrial autotest mode disabled"))
(progn
(advice-add 'save-buffer :after 'tertestrial-last-test)
(setf tertestrial-auto-test-mode t)
(message "Tertestrial autotest mode enabled"))))

(advice-add 'tertestrial-write-command :before
(lambda (&rest args)
(when (buffer-file-name)
(save-buffer))))
(save-buffer)
(tertestrial-last-test))))

(define-minor-mode tertestrial-mode
"Start tertestrial for the current project and enable keybindings."
Expand Down

0 comments on commit be8ecb5

Please sign in to comment.