Ruby-mode.el dies when breaking ternary exp

ruby-mode.el causes Emacs to consume all available CPU when using the
following odd indenting:

1: def foo
2: thingy = (bar.nil? ?
3: “goo” :
4: “stuff”)
5: end

Pressing return at the end of line 2, then hitting tab at the
beginning of line 3 causes the problem. The following doesn’t trigger
it, so I’m guessing that it’s getting confused by the double-? on line
2…

1: def foo
2: thingy = (bar.stuff ?
3: “foo” :
4: “stuff”)
5: end

Dan

···


/^Dan Debertin$/
airboss@nodewarrior.org
www.nodewarrior.org
ignorami: n:
The art of folding problem users into representational shapes.

Hi,

···

At Mon, 22 Jul 2002 01:40:42 +0900, Dan Debertin wrote:

ruby-mode.el causes Emacs to consume all available CPU when using the
following odd indenting:

1: def foo
2: thingy = (bar.nil? ?
3: “goo” :
4: “stuff”)
5: end

Does the patch fix it?

Index: ruby-mode.el

RCS file: /cvs/ruby/src/ruby/misc/ruby-mode.el,v
retrieving revision 1.53
diff -u -2 -p -r1.53 ruby-mode.el
— ruby-mode.el 28 Jun 2002 14:40:54 -0000 1.53
+++ ruby-mode.el 21 Jul 2002 17:14:13 -0000
@@ -358,6 +358,6 @@ The variable ruby-indent-level controls
((looking-at “\?”) ;skip ?char
(cond

  •    ((ruby-expr-beg)
    
  •     (looking-at "?\\(\\\\C-\\|\\\\M-\\)*.")
    
  •    ((and (ruby-expr-beg)
    
  •          (looking-at "?\\(\\\\C-\\|\\\\M-\\)*."))
        (goto-char (match-end 0)))
       (t
    


Nobu Nakada

Yes, that it does. Thanks!

Dan

···

At Mon, 22 Jul 2002 02:18:03 +0900, nobu.nokada@softhome.net wrote:

Does the patch fix it?


/^Dan Debertin$/
airboss@nodewarrior.org
www.nodewarrior.org
ignorami: n:
The art of folding problem users into representational shapes.

Hi,

···

At Mon, 22 Jul 2002 02:31:56 +0900, Dan Debertin wrote:

Yes, that it does. Thanks!

Although irrelevant to it, incidentally I made another patch
too. How about this?

Index: ruby-mode.el

RCS file: /cvs/ruby/src/ruby/misc/ruby-mode.el,v
retrieving revision 1.53
diff -u -2 -p -r1.53 ruby-mode.el
— ruby-mode.el 28 Jun 2002 14:40:54 -0000 1.53
+++ ruby-mode.el 21 Jul 2002 17:55:42 -0000
@@ -128,5 +128,6 @@

(defvar ruby-deep-arglist t

  • “*Deep indent argument lists when non-nil.”)
  • “*Deep indent argument lists when non-nil.
    +Also ignores spaces after parenthesis when 'space.”)

(eval-when-compile (require 'cl))
@@ -371,4 +372,6 @@ The variable ruby-indent-level controls
)
((and (looking-at “(”) ruby-deep-arglist)

  •   (and (eq ruby-deep-arglist 'space) (looking-at ".[ \t]+")
    
  •        (setq pnt (match-end 0)))
      (setq nest (cons (cons (char-after (point)) pnt) nest))
      (setq pcol (cons (cons pnt depth) pcol))
    


Nobu Nakada