Port Emacs support to using nrepl.el
technomancy opened this issue · 2 comments
technomancy commented
Current elisp implementation depends upon slime.
kingtim commented
Not sure how you'd like to structure the nrepl code wrt the slime code, but here is a slamhound function that will work with nrepl.el:
(defun nrepl-slamhound ()
"Run slamhound on the current buffer. Requires active nrepl connection."
(interactive)
(let* ((code (slamhound-clj-string buffer-file-name))
(result (plist-get (nrepl-send-string-sync code) :stdout)))
(if (string-match "^:error \\(.*\\)" result)
(error (match-string 1 result))
(goto-char (point-min))
(kill-sexp)
;; TODO: translate \n into newline
(insert result))))
If you'd like I can put it into a pull request.
technomancy commented
Thanks Tim! I went ahead and adapted this to support both slime and nrepl.el at the same time since it's only a couple lines of code.