kaz-yos / eval-in-repl

Consistent ESS-like eval interface for various REPLs
175 stars 27 forks source link

Allow passing arguments downstream eval-in-repl #6

Open arichiardi opened 9 years ago

arichiardi commented 9 years ago

It would be handy to have a fully transparent eir-eval-in-repl-lisp facade.

For example, we could pass arguments to it that would go directly downstream to the correct "implementation" (-cider, ...). Another use case, in lisp I am often instrumenting edebug according to the following:

With a prefix argument, C-M-x instruments the function definition for Edebug, the Emacs Lisp Debugger. See Instrumenting for Edebug in the Emacs Lisp Reference Manual. 

Do you think it would be hard to accomplish?

kaz-yos commented 9 years ago

Is "a single unified front end and implementation hiding" what you mean? I mean currently we need to configure each specific implementation and call it directly. This surely goes against SICP's "abstract and hide implementations as much as possible" principle. This may be worth thinking about.

For the argument passing part, I did not fully understand the use case you mentioned.

arichiardi commented 9 years ago

Hi Kaz, I did not intend to change the general architecture, what I meant was just to pass prefix arguments down eir-eval-in-repl-lisp to the respective called specific function.

This addition will just add a parameter to the function in order to accept it (maybe wrapped in a closure, I have not reviewed the rest of your code, just eval-in-repl.el:

(defun foo (arg)
      "Print the current raw prefix argument value."
      (interactive "P")

      (message "raw prefix arg is %S" arg))

Then of course you need to handle the argument, but in our case the receiving function. This is all in theory, because maybe su evaluating function doesn't accept argument (for instance return-ielm doesn't).

My specific use case is to instrument a function in edebug in ielm. Without ielm, I was basically executing C-u M-x eval-defun. Do you think I can achieve the same using eval-in-repl ?