IRB tab-completion fails for directories in ruby 0.9.1

Discussion in 'Ruby' started by Stuart Coleman, Sep 24, 2009.

  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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Stuart Coleman, Sep 24, 2009
    #1
    1. Advertising

  2. Stuart Coleman

    Seebs Guest

    On 2009-09-24, Stuart Coleman <> 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
    --
    Copyright 2009, all wrongs reversed. Peter Seebach /
    http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
    http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
     
    Seebs, Sep 24, 2009
    #2
    1. Advertising

  3. Seebs wrote:
    > On 2009-09-24, Stuart Coleman <> 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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Stuart Coleman, Sep 24, 2009
    #3
  4. Stuart Coleman

    cldwalker Guest


    > 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, Sep 25, 2009
    #4
  5. 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.
    --
    Posted via http://www.ruby-forum.com/.
     
    Stuart Coleman, Sep 25, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. News Sympatico
    Replies:
    0
    Views:
    319
    News Sympatico
    May 21, 2005
  2. ziggs
    Replies:
    2
    Views:
    201
    Henry Robinson
    Apr 21, 2004
  3. Jim Crossley

    Emacs irb with tab completion?

    Jim Crossley, Jan 30, 2005, in forum: Ruby
    Replies:
    0
    Views:
    177
    Jim Crossley
    Jan 30, 2005
  4. Unnsse Khan
    Replies:
    5
    Views:
    136
    Peter Burns
    Oct 22, 2005
  5. Julius Gustavsson
    Replies:
    0
    Views:
    121
    Julius Gustavsson
    Jun 1, 2008
Loading...

Share This Page