Open berkan opened 7 years ago
Thanks. This solution is greatly overthinking things IMO, and adds unnecessary complexity: it would be conceptually much simpler to just add a separate command that evaluates the selected region and prints the result in the minibuffer.
This change allows
elm-repl-push
andelm-repl-push-decl
to work without switching to the REPL buffer.The use-case I'm addressing is to evaluate code directly from a source code buffer, with minimum disruptions.
The details of the change are:
elm-repl-push
&elm-repl-push-decl
accept a universal argument which controls whether or not to switch to the REPL buffer after the push.The default behaviour is:
nil
, switch to the REPL buffer (the same as the current behaviour)non-nil
, stay in the current buffer after the pushSetting the variable
elm-interactive-flip-arg-switch-behaviour
tonon-nil
reverses the default behaviour above.So, anybody who didn't want to switch to the REPL buffer after a push and don't want to use the universal argument all the time can set this to
t
.After a push, functions in
elm-interactive-after-push-hook
are run with the result of the last pushelm--print-result
which prints the first line of a possibly multi-line string in the echo area (this is so that the echo area doesn't grow and create an unnecessary visual distraction)