joaotavora / sly

Sylvester the Cat's Common Lisp IDE
1.26k stars 142 forks source link

Print evaluated form in sly-mrepl instead of only result in mini buffer #275

Open arichiardi opened 4 years ago

arichiardi commented 4 years ago

Hi @joaotavora, I am starting out with Common Lisp after quite a bit of Clojure and I was wondering if I could have a workflow where I evaluate the last sexp and see it in comint together with the result.

I have contributed quite a bit to https://github.com/clojure-emacs/inf-clojure back in the days and we were about to achieve that with comint-send-string if I remember correctly.

I was wondering if you were interested in this feature.

If so, I have a question, I skimmed through the code but I haven't figured out how to obtain the comint process yet.

Thanks and keep up the good work!

arichiardi commented 4 years ago

Ok actually this was easy from the sly-mrepl buffer:

(comint-send-string (get-buffer-process (current-buffer)) "(+ 1 1)")

And I see it in the buffer.

I probably then need to understand more about connections when doing it from the code buffers.

arichiardi commented 4 years ago

For completeness, this package shows the workflow I am looking for :smile:

https://github.com/kaz-yos/eval-in-repl

But no worries, if not possible I can always adapt :wink:

arichiardi commented 4 years ago

I think I am deep in a rabbit hole as I was trying to implement an extension for eval-in-repl.

I found a small road block for now.

Basically that library needs a zero-arity function that does the evaluation of whatever is at point.

For example in cider it just calls cider-repl-return.

arichiardi commented 4 years ago

Found some more info, still haven't had time for it properly:

https://stackoverflow.com/questions/13103177/nrepl-el-how-to-eval-clojure-buffer-form-to-nrepl-buffer-instead-of-echo-area

arichiardi commented 4 years ago

So I added support for sly in eval-in-repl.

However I am still not 100% satisfied with the flow.