Skip to content

Commit

Permalink
inf-ruby-console-gem: Support new IRB
Browse files Browse the repository at this point in the history
Fixes #128
  • Loading branch information
dgutov committed Mar 3, 2020
1 parent 1b89400 commit e4ae089
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions inf-ruby.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit e4ae089

Please sign in to comment.