Skip to content

Instantly share code, notes, and snippets.

@danlentz
Created September 9, 2013 00:11
Show Gist options
  • Save danlentz/6489830 to your computer and use it in GitHub Desktop.
Save danlentz/6489830 to your computer and use it in GitHub Desktop.
(defun nrepl-interactive-eval-print-comment-handler (buffer)
(nrepl-make-response-handler buffer
(lambda (buffer value)
(with-current-buffer buffer
(insert (format " ;; %s" value))))
'()
(lambda (buffer err)
(message (format " ;; %s" err)))
'()))
(defun nrepl-interactive-eval-print-comment (form)
"Evaluate the given form and print value in current buffer."
(let ((buffer (current-buffer)))
(nrepl-send-string form
(nrepl-interactive-eval-print-comment-handler buffer)
nrepl-buffer-ns)))
(defun nrepl-eval-region-comment (start end)
"Evaluate region."
(interactive "r")
(nrepl-interactive-eval-print-comment (buffer-substring-no-properties start end)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment