0

As the title says, when I run the Ruby interactive shell irb in a shell-mode buffer on MacOS, my input line is echoed back many times, character by successive character. Example:

irb(main):001> 1+1 irb(main):001> 1irb(main):001* 1+irb(main):001> 1+1irb(main):001> 1+1 => 2 

That's for just three input characters. More characters can produce an extremely long echo line.

This doesn't happen for other interactive shells, like Raku or Python. It also doesn't happen for irb if I run it in a non-Emacs terminal. It also doesn't happen for irb in an Emacs term terminal, which I just thought to check.

All I can find by searching for relevant terms is a phenomenon whereby the entire input line is echoed at once. I recently arranged to set the Emacs variable comint-process-echoes to t, but I don't recall exactly why I needed to. In any case, this variable has no effect on the kind of echoing I've described.

Any tips on investigating or addressing this weirdness?

1 Answer 1

1

This behavior comes with the latest versions of Irb which use Reline by default instead of libreadline.

See this issue for more details.

The solution is to invoke irb --nomultiline --nosingleline, to enable the simpler interaction mode. You might also want to try inf-ruby instead of running the REPL in shell-mode.

2
  • I saw the same echoing behavior in the inf-ruby buffer. The inf-ruby Github page mentions setting some irb configuration variables in ~/.irbrc, which also fixes the problem in shell-mode. Commented Apr 11, 2024 at 17:56
  • @Sean M-x inf-ruby should automatically detect whether these flags are required. Perhaps something new problem came up with some new release. You're welcome to file a bug for inf-ruby with your specific versions of ruby and irb, and I'll take a look. Commented Apr 11, 2024 at 22:31

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.