Irb Tab completion problem in Emacs

Hi everyone,

I just installed Ruby 2.4.2 from source.
and I am using Emacs 24.4.1 in Debian 8.9.

If I run irb in xterm, then Tab-completion *works*.

If i run irb in an Emacs shell with "M-x shell", then Tab-completion *does not work*.

If I run irb in an Emacs shell with "M-x ansi-term", then Tab-completion *works*.

I would like to be able to use irb in Emacs "M-x shell" because
there it is easy to move and copy/paste code.

Do you know how to achieve this ?

I prefer to use an Emacs shell over installing a specialized ".el" just for Ruby.
Because Emacs + "M-x shell" + "isend-mode" is what I use for all other programming languages
having a REPL .

Bye
Nicola

Hi everyone,

I just installed Ruby 2.4.2 from source.
and I am using Emacs 24.4.1 in Debian 8.9.

If I run irb in xterm, then Tab-completion *works*.

If i run irb in an Emacs shell with "M-x shell", then Tab-completion *does not work*.

If I run irb in an Emacs shell with "M-x ansi-term", then Tab-completion *works*.

I would like to be able to use irb in Emacs "M-x shell" because
there it is easy to move and copy/paste code.

This is more of an emacs question than a ruby one… that said, define “works”… Tab is doing what emacs is programmed to do.

Fire up `M-x shell RET`, then run irb. At the prompt, type “C-h k TAB” (describe-key) and you’ll see what it is bound to. For me, that’s:

TAB (translated from <tab>) runs the command completion-at-point
(found in shell-mode-map), which is an interactive compiled Lisp
function in ‘minibuffer.el’.

It is bound to TAB, <menu-bar> <completion> <complete>.

(completion-at-point)

Perform completion on the text around point.
The completion method is determined by ‘completion-at-point-functions’.

which is an emacs function. If you click on the hyperlinked “minibuffer.el” you’ll jump to the source and can poke around… basically, this is running an *emacs* completion, rather than sending a tab to irb.

You might want to look into using the `inf-ruby` library. For me, TAB is still bound to the same function, but it is running in inf-ruby-mode instead of shell-mode so it’ll be less intrusive to bind TAB to something raw or specific to inf-ruby.

inf-ruby-mode (the function) has doco that says:

`TAB' completes the input at point. IRB, Pry and Bond completion is supported.

Looks like you want to look at `inf-ruby-completions` and `inf-ruby-completion-at-point`.

···

On Nov 20, 2017, at 08:30, Nicola Mingotti <nmingotti@gmail.com> wrote:

Thank you a lot for the very detailed explanation !

I will do some experiments as soon as i can

Bye
Nicola

···

On 28/11/2017 21:46, Ryan Davis wrote:

On Nov 20, 2017, at 08:30, Nicola Mingotti <nmingotti@gmail.com> wrote:

Hi everyone,

I just installed Ruby 2.4.2 from source.
and I am using Emacs 24.4.1 in Debian 8.9.

If I run irb in xterm, then Tab-completion *works*.

If i run irb in an Emacs shell with "M-x shell", then Tab-completion *does not work*.

If I run irb in an Emacs shell with "M-x ansi-term", then Tab-completion *works*.

I would like to be able to use irb in Emacs "M-x shell" because
there it is easy to move and copy/paste code.

This is more of an emacs question than a ruby one… that said, define “works”… Tab is doing what emacs is programmed to do.

Fire up `M-x shell RET`, then run irb. At the prompt, type “C-h k TAB” (describe-key) and you’ll see what it is bound to. For me, that’s:

TAB (translated from <tab>) runs the command completion-at-point
(found in shell-mode-map), which is an interactive compiled Lisp
function in ‘minibuffer.el’.

It is bound to TAB, <menu-bar> <completion> <complete>.

(completion-at-point)

Perform completion on the text around point.
The completion method is determined by ‘completion-at-point-functions’.

which is an emacs function. If you click on the hyperlinked “minibuffer.el” you’ll jump to the source and can poke around… basically, this is running an *emacs* completion, rather than sending a tab to irb.

You might want to look into using the `inf-ruby` library. For me, TAB is still bound to the same function, but it is running in inf-ruby-mode instead of shell-mode so it’ll be less intrusive to bind TAB to something raw or specific to inf-ruby.

inf-ruby-mode (the function) has doco that says:

`TAB' completes the input at point. IRB, Pry and Bond completion is supported.

Looks like you want to look at `inf-ruby-completions` and `inf-ruby-completion-at-point`.

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;