-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Incompatible with latest IRB #128
Comments
I suspect this is rather the same as #127 Better, rbenv-aware patches welcome. |
Hm, interesting. Yes, that seems possible, though this fix doesn't work for me because it's running It doesn't solve the bundle console problem, however. Is there a way to force inf-ruby to use straight irb? |
Sure: you call
Please go ahead and test it. Does it make |
It does not work. I still get the Even on IRB 1.1.0 is what I have with ruby 2.5.5, and when running it, it prints:
I'm quite confused... |
A few things: The version of IRB (0.9.6) included with Ruby 2.5.7 (I just installed) doesn't have this problem. But you can install a newer IRB from Rubygems, and it indeed exhibits this behavior. I'm guessing Also see ruby/irb#68. |
Okay, that worked, thank you. How might one fix this for auto/bundle console? (which is apparently deprecated now...) |
Just call |
Unfortunately, that doesn't use |
|
I didn't have a bin/console in this project. It ended up using |
I think the original deprecation message said you should generate it with Or maybe generate it in a test project and then copy it over. |
Even if I do that, the bin/console script invokes irb without arguments, which means that it has the same multiline issue. I could replace bin/console with something that ran irb with the appropriate arguments, but then I'd need to do that for every project and it seems like a bit of a hack since the idea of using bin/console, I'm guessing, is to have a sort of zero-config, "it just works" option. |
I agree that it seems suboptimal, but it seems like the officially recommended option. Unless IRB can read the necessary arguments from environment variables... |
I don't know if it's possible to handle new irb prompt in Emacs (it seems it emits escape sequences that maybe could be handled), but I solved the problem of broken prompt of bundle console by adding to |
@link0ff Thanks for the workaround. I've pushed a user-friendlier fix now. |
So... that fix should help the @aaronjensen Could you test this additional patch? diff --git a/inf-ruby.el b/inf-ruby.el
index f93164f..8a21039 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -102,12 +102,16 @@ returns a string."
:group 'inf-ruby)
(defun inf-ruby--irb-command ()
- (let ((command "irb --prompt default --noreadline -r irb/completion")
- (version (nth 1 (split-string (shell-command-to-string "irb -v") "[ (]"))))
- (when (version<= "1.2.0" version)
+ (let ((command "irb --prompt default --noreadline -r irb/completion"))
+ (when (inf-ruby--irb-needs-nomultiline-p)
(setq command (concat command " --nomultiline")))
command))
+(defun inf-ruby--irb-needs-nomultiline-p ()
+ (let ((version (nth 1 (split-string
+ (shell-command-to-string "irb -v") "[ (]"))))
+ (version<= "1.2.0" version)))
+
(defcustom inf-ruby-console-environment 'ask
"Envronment to use for the `inf-ruby-console-*' commands.
If the value is not a string, ask the user to choose from the
@@ -929,6 +933,8 @@ Gemfile, it should use the `gemspec' instruction."
(concat " -r " (file-name-sans-extension file)))
files
""))))
+ (when (inf-ruby--irb-needs-nomultiline-p)
+ (setq base-command (concat base-command " --nomultiline")))
(inf-ruby-console-run
(concat base-command args
" --prompt default --noreadline -r irb/completion") |
@dgutov it seems to work for me with ruby 2.7. As far as I can tell, it did not require the main gem entry point--is it supposed to do that? |
Thanks for verifying.
Does the current version do that? If not, it seems like a separate issue. Though maybe your entry point doesn't adhere to the naming conventions. |
This is the case. The name of the gem includes an extra prefix, but it doesn't match the directory structure. |
OK, then it's orthogonal, at least. I'm gonna push the fix now. |
I don't know where to mention this, but in Ruby 3.1 using the bundled debugger has the same problem that it displays the triangle character and hangs the comint buffer. A workaround is to use the env.variable |
@link0ff A new report is probably a better place (or a PR). I haven't used the bundled myself yet. It sounds like a new entry in the Bugs section of the Readme, at least. Though unlike |
A new report is in #158. I don't know if a single file is possible to put that env.var setting. |
When running
inf-ruby-console-default
in a project that works with Ruby 2.5.5, I see this:If I type after the
▽
and press enter, nothing happens. If I switch to Ruby 2.5.5, this all works as expected.The text was updated successfully, but these errors were encountered: