Closed MdeLv closed 2 years ago
Do you sometimes evaluate region?
Evaluating a region actually evaluates the smallest phrase containing that region.
I already use the following workaround: I copy the so-called "region" foo
within a phrase such as let _ = foo
that is correctly given to the Toplevel with (tuareg-eval-phrase)
, which makes editing heavy.
But do you see a simple way to instruct the tuareg extension that I want it to send only the marked text to the Toplevel?
In other words, as the function is (tuareg-eval-region START END)
, how to send START and END parameters as those of the marked text? (and not START and END of OCaml containing phrase).
Pls consider that I'm slightly aware of the related Elisp/Emacs syntax.
Thanks.
In PR #274, tuareg-eval-region
has been restored to its intended mode of operation: evaluate the smallest set of phrases intersecting the region.
However, it's not obvious that this is optimal: it's frequently useful to evaluate just a part of a phrase (an expression, for example), and we already have tuareg-eval-phrase
for doing the containing-phrase thing. It's also quite easy to mark a defun or phrase (C-M-h).
@mattiase You are right. Let's extend tuareg-eval-phrase
so it does the above when the region is active and let tuareg-eval-region
just send the region (whether it is a valid expression or not). May you amend https://github.com/ocaml/tuareg/pull/274 for that?
Certainly, have a look at this.
I think this bug can be closed. Everything seems to be merged.
Debian 10 Emacs 26.1 ocaml.4.07.1
tuareg-eval-phrase works well. However, I can't make tuareg-eval-region working. I select a region, then call this function (menu or shortcut) but it evaluates the phrase. Is there something to tweak?
Thanks.