Permalink
Browse files

Display Clojure test failures right in the code buffer

  • Loading branch information...
1 parent 6cf13e1 commit 4d135730524fd88c2ba14bfe7c0d6e67aeab8bc0 @maio committed Aug 30, 2013
Showing with 22 additions and 2 deletions.
  1. +1 −0 emacs/emacs
  2. +21 −2 emacs/emacs.d/maio-clojure.el
View
@@ -17,6 +17,7 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
+ '(clojure-test-failure-face ((t (:foreground "brightred"))))
'(hl-line ((t (:inherit highlight))))
'(idle-highlight ((t (:inherit hl-line))))
'(italic ((t (:underline nil :slant italic))))
@@ -7,11 +7,30 @@
(call-interactively 'nrepl-switch-to-repl-buffer)
(call-interactively 'nrepl)))
+(defun maio/delete-nrepl-error-window ()
+ (interactive)
+ (when (get-buffer "*nrepl-error*")
+ (let ((nrepl-error-window (get-buffer-window (get-buffer "*nrepl-error*"))))
+ (when nrepl-error-window
+ (delete-window nrepl-error-window)))))
+
(eval-after-load 'clojure-mode
'(progn
+ (require 'midje-mode)
(require 'clojure-test-mode)
- (defadvice clojure-test-run-tests (before save activate) (save-buffer))
- (key-chord-define clojure-test-mode-map ";e" 'clojure-test-run-tests)
+ (defadvice clojure-test-run-tests (before clear-and-save activate)
+ (maio/delete-nrepl-error-window)
+ (midje-clear-comments)
+ (save-buffer))
+ (defadvice clojure-test-highlight-problem (after comment (line event message pp-actual) activate)
+ (save-excursion
+ (goto-char (point-min))
+ (forward-line (1- line))
+ (beginning-of-line)
+ (call-interactively 'open-line)
+ (indent-according-to-mode)
+ (midje-insert-failure-message message)))
+ (key-chord-define clojure-test-mode-map ";w" 'clojure-test-run-tests)
(evil-define-key 'normal clojure-mode-map "gs" 'maio/nrepl)
(evil-define-key 'normal clojure-mode-map (kbd "M-.") 'nrepl-jump)
(add-hook 'clojure-mode-hook 'eldoc-mode)

0 comments on commit 4d13573

Please sign in to comment.