IRB tab-completion fails for directories in ruby 0.9.1

I recently upgraded from Ruby 0.8.6 to 0.9.1, and was trying out some
old scripts to make sure they worked. The scripts were typically run in
IRB and performed some calculations with data saved in a networked
drive. Because the scripts are stored on my local computer I would have
to navigate over to the drive by doing something like:
“ScriptName.action ‘Z:/directory/filename.bin’”. In 0.8.6 I was able to
enter that filepath through tab completion, but this no longer works.

After trying to debug this problem it seems that IRB now only allows tab
completion for the methods you get from entering “require
‘irb/completion’”, and whatever is in the folder IRB is launched from.
So if I launch from folder “foo” which contains folder “bar”, I can tab
complete ‘bar/’ but won’t see anything in that folder.

I feel pretty confident that getting back to the old behavior is a
simple matter of setting some option, but can’t for the life of me find
it (I’ve been googling for some time now). Any help is much appreciated.

On 2009-09-24, Stuart C. [email protected] wrote:

I recently upgraded from Ruby 0.8.6 to 0.9.1,

Might you mean 1.8.6 and 1.9.1?

If not, I might recommend that you try something a LITTLE more recent,
because I’m pretty sure 0.9.1 was a while back.

(And I’m afraid I’m otherwise useless to you, as I didn’t even know irb
had any kind of tab completion at all.)

-s

Seebs wrote:

On 2009-09-24, Stuart C. [email protected] wrote:

I recently upgraded from Ruby 0.8.6 to 0.9.1,

Might you mean 1.8.6 and 1.9.1?

If not, I might recommend that you try something a LITTLE more recent,
because I’m pretty sure 0.9.1 was a while back.

(And I’m afraid I’m otherwise useless to you, as I didn’t even know irb
had any kind of tab completion at all.)

-s

Yeah, I noticed that error slightly after posting, but couldn’t see a
way to edit. That’s the problem with working with a bunch of different
versions of several different packages, version numbers get all jumbled
up.

After trying to debug this problem it seems that IRB now only allows tab
completion for the methods you get from entering “require
‘irb/completion’”, and whatever is in the folder IRB is launched from.
So if I launch from folder “foo” which contains folder “bar”, I can tab
complete ‘bar/’ but won’t see anything in that folder.

If you start irb without completion i.e. irb -f, irb should let
readline
default to file completion. You can also explicitly tell readline to
do file
completion but then you will lose irb’s method completion:

Readline.completion_proc = Readline::FILENAME_COMPLETION_PROC

If you’re still having trouble with completing subdirectories, you may
need to tweak
some Readline settings:
http://ruby-doc.org/core-1.9/classes/Readline.html#M003133

cldwalker wrote:

If you start irb without completion i.e. irb -f, irb should let
readline
default to file completion. You can also explicitly tell readline to
do file
completion but then you will lose irb’s method completion:

Readline.completion_proc = Readline::FILENAME_COMPLETION_PROC

If you’re still having trouble with completing subdirectories, you may
need to tweak
some Readline settings:
http://ruby-doc.org/core-1.9/classes/Readline.html#M003133

I tried starting with -f, that didn’t work. I tried starting with
–readline, that didn’t work. I tried both, I tried entering
“Readline.completion_proc = Readline::FILENAME_COMPLETION_PROC” after
each of those things, and that didn’t work.

All of this (besides the launching commands) has been done in IRB
itself. I tried setting the config file but can’t find the damn thing,
and don’t think it should matter anyway (it seems like those are only
settings you can set either within IRB or as you launch it).

As for tweaking Readline itself, how would I go about doing that? I’m
not even sure where to begin with that.

Thanks for your help.