1

I have the following code:

  (defconst cljs-test-report-buffer "*cljs-test-report*"
    "Buffer name in which to display test reports.")

  (defun cider-test-show-report ()
    "Show the test report buffer, if one exists."
    (interactive)
    (if-let* ((report-buffer (get-buffer cljs-test-report-buffer)))
        (switch-to-buffer report-buffer)
      (message "No test report buffer")))

  (defun run-cljs-test-in-ns ()
    (interactive)
    (cider-interactive-eval "(cljs.test/run-tests)")) 
;; want to show this result in the ```cljs-test-report-buffer```

And I want to show the result of the run-cljs-test-in-ns function in a new buffer, that is cleared every time this function is run. How can I do that?

  • You should specify in your question that you want to interact with cider, not just inserting a string/text in a buffer. I know nothing about cider-interactive-eval, or cider itself so I don't know what you expect. find-file, insert and revert-buffer will be a vanilla approach that will fit the question subject although I suspect it'll fall short, and comint maybe a long shot. – Muihlinn Apr 27 at 21:31
2

You can use this, in place of just (run-cljs-test-in-ns):

(pp-display-expression (run-cljs-test-in-ns) cljs-test-report-buffer)

That assumes that whatever function run-cljs-test-in-ns returns is what you want to show, and the value of cljs-test-report-buffer is the buffer or name of the buffer where you want to show it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.