Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to evaluate code via elm-repl-push{-decl} without switching to the REPL buffer #113

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

berkan
Copy link
Contributor

@berkan berkan commented Jul 27, 2017

This change allows elm-repl-push and elm-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:

    • if the universal argument is not given or nil, switch to the REPL buffer (the same as the current behaviour)
    • if the universal argument is non-nil, stay in the current buffer after the push
  • Setting the variable elm-interactive-flip-arg-switch-behaviour to non-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 push

    • Currently this hook contains elm--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)

@berkan berkan changed the title elm-repl-push/no-switch ability to evaluate code via elm-repl-push-{decl} without switching to the REPL buffer Jul 27, 2017
@berkan berkan changed the title ability to evaluate code via elm-repl-push-{decl} without switching to the REPL buffer ability to evaluate code via elm-repl-push{-decl} without switching to the REPL buffer Jul 27, 2017
* 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
* variable elm-interactive-flip-arg-switch-behaviour determines the effect of
  the universal argument
* after a push, functions in elm-interactive-after-push-hook are run with the
  result of the last push
@purcell
Copy link
Collaborator

purcell commented Jul 29, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants