Closed angrycandy closed 2 years ago
Hi @angrycandy! Thanks for opening this issue. This issue occurs when trying to send Elixir code to a REPL that exists outside of any Mix project. This is a thing that inf-elixir
should support, but I've been conflicted as to what approach makes the most sense.
Either:
send-*
commands inside a project, the string will be sent that project's REPL (current functionality) and if the user uses the send-*
commands outside any Mix project, the string will be sent to the one-and-only non-project REPL.sql-set-sqli-buffer-generally
). A hybrid where the user sets the recipient REPL once per buffer with the ability to change it manually might make the most sense.I'd welcome your thoughts on this!
Thanks for the quick response @J3RN. My preference is a "hybrid where the user sets the recipient REPL once per buffer with the ability to change it manually".
Hey, a good place to look for some inspiration may be https://github.com/greghendershott/racket-mode. I don't know if the fact that it's both the major-mode and the repl mode will be a problem or not, but I think the way they handle repl buffers per edit buffer is by attaching each other's names to local vars. In projects, I think it sets the entire project to the one repl, or at least it can.
Also, FWIW, I find racket-mode to be a nice featureful and simple example of an interactive mode for emacs. Less powerful than say SLIME, Cider, or Alchemist, but obviously less complex.
@ZachFontenot Thanks for the tip! :sparkles:
I think the way they handle repl buffers per edit buffer is by attaching each other's names to local vars.
Yeah, this is how I was thinking of doing it as well, but (IIRC) it implies a considerable rewrite of existing functionality. Sadly this has fallen on the back burner for me, no guarantee as to when I'll be able to get to it :sweat:
After a little over a year, I've pushed a "fix" for this that I've been using locally for a month or so. I'm pretty happy with it, and I hope others are as well.
The big highlight is that the choosing logic is a bit more thorough and considers more cases. I published a wiki page that illustrates the buffer-choosing process.
The other good thing to know is that I added an inf-elixir-set-repl
command that, when invoked, allows the user to choose a an existing REPL or to create a new REPL for inf-elixir-send-*
commands to target. The setting is buffer-local, so different buffers can target different REPLs. If all else fails, this relatively brute-force approach should work :grin:
I'm closing this issue as the originally reported issue should be resolved (once the update rolls out on MELPA). If anyone has an issue with REPL-choosing logic going forward, please open a new issue :smiley:
With this configured:
I run
inf-elixir
, see the iex buffer start, and theninf-elixir-send-line
causes error messageNo REPL running in
.And I'm just starting to learn elixir with https://elixir-lang.org/getting-started/introduction.html so the directory has just one file, scratch.ex, for the tutorial code.
I'm using: