Hi,

At Sat, 29 Dec 2001 03:15:20 +0900,
Le Wang <lewang@===.===bigfoot.com (nospam)> wrote:
> If you press tab (ruby-indent-command) on line 11, the indentation
> gets messed up, and indentation stops working from that point forward,
> for the remainder of the method definition.

The problem is that nested parentheses are ignored.


Index: ruby-mode.el =================================================================== RCS file: /cvs/ruby/src/ruby/misc/ruby-mode.el,v retrieving revision 1.39 diff -u -2 -p -r1.39 ruby-mode.el --- ruby-mode.el 2001/12/21 09:23:28 1.39 +++ ruby-mode.el 2001/12/28 22:36:08 @@ -271,5 +271,5 @@ The variable ruby-indent-level controls (re-search-forward ruby-delimiter indent-point t)) (or depth (setq depth 0)) - (let ((pnt (point)) w) + (let ((pnt (point)) w re) (goto-char (match-beginning 0)) (cond @@ -303,15 +303,25 @@ The variable ruby-indent-level controls (match-end 1))) (cond - ((string= w "[") (setq w "\\]")) - ((string= w "{") (setq w "}")) - ((string= w "(") (setq w ")")) - ((string= w "<") (setq w ">")) + ((string= w "[") (setq re "][")) + ((string= w "{") (setq re "}{")) + ((string= w "(") (setq re ")(")) + ((string= w "<") (setq re "><")) ((member w '("*" "." "+" "?" "^" "$")) (setq w (concat "\\" w)))) - (if (re-search-forward - (if (string= w "\\") - "\\\\[^\\]*\\\\" - (concat "[^\\]\\(\\\\\\\\\\)*" w)) - indent-point t) + (if (if re + (let ((n 1)) + (setq re (concat "[^\\]\\(\\\\\\\\\\)*[" re "]")) + (while (and (re-search-forward re indent-point t) + (> (setq n (if (eq (char-before (point)) + (string-to-char w)) + (1+ n) (1- n))) + 0)) + (forward-char -1)) + (zerop n)) + (re-search-forward + (if (string= w "\\") + "\\\\[^\\]*\\\\" + (concat "[^\\]\\(\\\\\\\\\\)*" w)) + indent-point t)) nil (setq in-string (point))
Nobu Nakada