Comments (13)
Hey @andreas-roehler -- I just tried your example in the IEx prompt started by elixir-mode-iex
and found the same issue. I'd give that a try, and if you find that you still have the issue then elixir-lang/emacs-elixir is probably the culprit rather than alchemist.
from alchemist.el.
Sorry -- scratch what I said. What command are you using for newlines? I found that I was actually using electric-newline-maybe-indent
. comint-send-input
, however, works like a charm.
from alchemist.el.
So do I, after "end" RET, which does comint-send-input. Still hangs...
from alchemist.el.
BTW: it's the only example bug shows up - commonly iex works well from alchemist.
from alchemist.el.
@andreas-roehler thanks for reporting, this looks really like a bug and I'll try to find the issue.
Thanks @jtmoulia for helping ❤️
from alchemist.el.
I did some investigating and somehow comint and IEx don't get along.
Here's the minimal test case:
(apply 'make-comint "IEX"
"/usr/local/bin/iex" nil nil)
got to IEX buffer and paste
"""
foo
"""
and IEX appears to hang.
Erl works fine.
(apply 'make-comint "ERL"
"/usr/bin/erl" nil nil)
and paste
"""
foo
"""
.
I was wondering if it was something about the prompt. To rule it out I setup .iex.exs
IEx.configure(alive_prompt: "%counter>", default_prompt: "%counter>",)
This makes IEx prompt the same as erl's default prompt. Still hangs with multiline input.
from alchemist.el.
The problem may be in IEx itself.
iex | cat
paste a multi-line expression, get a hang
from alchemist.el.
Jose confirms problem in IEx:
https://groups.google.com/forum/#!topic/elixir-lang-talk/HoTY3YZP3y8
from alchemist.el.
Thanks a lot guys for all the effort you put into hunting the issue.
My apology for respond a but late, but all these holidays and my kids were ill too made my days a bit busy. :-)
I have kind of an idea to fix this issue, I'll get back to you if I have a branch for testing ready.
from alchemist.el.
@tonini What's the idea? Tell us more :-)
Still waiting for a reply from Jose on what's the underlying problem with IEx.
Meanwhile I hacked together an IEx wrapper script that seems to workaround the problem. The idea is to always wait for a prompt (maybe secondary prompt) before sending another line of input. Seems to work, even if there are potential corner case correctness issues.
Edit: cleaned up the script
#!/usr/bin/env ruby
# based on http://stackoverflow.com/questions/2730642/wrapper-around-bash-control-stdin-and-stdout
require 'pty'
require 'thread'
mutex = Mutex.new
saw_prompt = ConditionVariable.new
system('stty -echo') if ENV['Emacs']
PTY.spawn("/usr/local/bin/iex") do |p_read, p_write|
Thread.new do
loop do
mutex.synchronize {
saw_prompt.wait(mutex)
input = STDIN.gets
# puts "== read from STDIN: #{input}"
# STDOUT.flush
p_write.print input
# puts "== wrote to process: #{input}"
}
end
end
loop do
output = p_read.sysread(512)
# puts "== read from process: #{output}"
print output
# puts "wrote to STDOUT: #{output}"
STDOUT.flush
saw_prompt.signal if output.include?("iex(") || output.include?("...(")
end
end
from alchemist.el.
@gleb If the underlaying problem could be fixed Elixir wise that would be great!
On the other hand I realized that there is an issue that we have to wait until the IEx
prompt is showed up again after an input. So what I did is sending just always one line to the running IEx
process instead the whole block including newlines and then always wait until the prompt is visible again. Works actually solid so far.
I will push the branch soon so you guys could test it.
from alchemist.el.
@gleb @andreas-roehler is fixed on master
from alchemist.el.
@tonini Works for me. Thanks! Will use/test it more, and let you know if anything comes up.
from alchemist.el.
Related Issues (20)
- Jump to definition functionality broken by multi-line aliasing
- Alchemist is using wrong version
- Switch to/scroll in help HOT 1
- Multiple instances of Iex repl
- alchemist-goto-definition-at-point crashes server when editing files with multiple import
- Eldoc support
- Changing alchemist-key-command-prefix not working HOT 4
- Compilation errors and warnings when running tests aren't clickable
- `alchemist-report-filter` fails to display relevant output HOT 2
- iex run current buffer
- How to run tests and jump the test output buffer?
- question about evaluation coming from lisp/slime HOT 1
- Alchemist Emacs menu is empty HOT 1
- Can't jumping to the definition of a function which is defined in a module imported by the __using__ macro.
- Spam on alchemist-elixir.org HOT 4
- mix.el - new Emacs package for Mix HOT 2
- Alchemist Resurrection HOT 21
- Hey there.
- `alchemist-iex-run` does not find `erl`
- Alchemist alternative
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alchemist.el.