Emacs' ruby-mode, irb and line numbers

Hello,

I’m using Emacs’ ruby-mode together with irb as inferior ruby, but the
line numbers for exceptions end up completely wrong:

irb(main):1495:0> t = Ribbit::TargetFactory.new(1, :snmp, ‘ti100710a080’)
"ti100710a080"
ArgumentError: mandatory argument “specifier_id” missing
from (irb):1459:in initialize' from (irb):1472:innew’
from (irb):1472:in initialize' from (irb):1495:innew’
from (irb):1495
irb(main):1496:0>

The line numbers reported by irb are in this case about 1200 lines too
big.

Actually, this is caused by two unrelated problems:

  • Line numbers are not adjusted in irb before it evaluates a chunk of
    Ruby code, causing the source references to be wrong.
  • C-c C-e causes irb to print a bunch of prompts, one for each source
    line) causing the line number counter to increment repidly.

I have spent the previous 30-40 minutes searching web and docs, but at
no avail. I would be very grateful if anyone could provide a solution
to these problems.

Thanks in advance!

···


I’ve seen things you people wouldn’t believe. Attack ships on fire off
the shores of the Nonestic Ocean. I watched magic blunderbusses flash
and glitter in the dark near Glindea’s Palace. All those moments will
be lost in time, like tears in rain. Time to die…

Forgot the technical information:

ruby-mode 1.58
irb 0.9-02.07.03
GNU Emacs 21.2.1
Debian Sarge

Here’s an example, given the code:

def pow(x)
x * x
end

pow()

Which I evaluate twice (C-c C-e):

irb(main):001:0> irb(main):002:1> irb(main):003:1> nil
irb(main):004:0> ArgumentError: wrong # of arguments(0 for 1)
from (irb):5:in pow' from (irb):5 irb(main):006:0> irb(main):007:1> irb(main):008:1> nil irb(main):009:0> ArgumentError: wrong # of arguments(0 for 1) from (irb):10:inpow’
from (irb):10
irb(main):011:0>

As you can see, it reports the error on line 5 the first time and line
10 the second.

···

Bjørn Nordbø bn@strangedays.no wrote:

I’m using Emacs’ ruby-mode together with irb as inferior ruby, but the
line numbers for exceptions end up completely wrong:


I’ve seen things you people wouldn’t believe. Attack ships on fire off
the shores of the Nonestic Ocean. I watched magic blunderbusses flash
and glitter in the dark near Glindea’s Palace. All those moments will
be lost in time, like tears in rain. Time to die…