summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-05-24 04:34:26 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-05-24 04:34:26 +0000
commit8b1de0b1ad49733abeddd8be359ae816b29de59a (patch)
treea7ed03dd3f6442635f694c4367bcd94be57f6dbd /misc
parent24b9bdca25dc431aff935df7739b9c5ea0ee4077 (diff)
2000-05-24
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'misc')
-rw-r--r--misc/ruby-mode.el41
1 files changed, 39 insertions, 2 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index a882f9fba1..a0a770b473 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -14,7 +14,11 @@
(substring ruby-mode-revision (match-beginning 0) (match-end 0))))
(defconst ruby-block-beg-re
- "class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin\\|do"
+ "class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin"
+ )
+
+(defconst ruby-non-block-do-re
+ "while\\|until\\|for\\|rescue"
)
(defconst ruby-indent-beg-re
@@ -372,6 +376,39 @@ The variable ruby-indent-level controls the amount of indentation.
(goto-char (match-end 0)))
((looking-at ruby-block-beg-re)
(and
+ (or (not (looking-at "do\\>[^_]"))
+ (save-excursion
+ (back-to-indentation)
+ (not (looking-at ruby-non-block-do-re))))
+ (or (bolp)
+ (progn
+ (forward-char -1)
+ (setq w (char-after (point)))
+ (not (or (eq ?_ w)
+ (eq ?. w)))))
+ (goto-char pnt)
+ (setq w (char-after (point)))
+ (not (eq ?_ w))
+ (not (eq ?! w))
+ (not (eq ?? w))
+ (skip-chars-forward " \t")
+ (if (not (eolp))
+ (progn
+ (goto-char (match-beginning 0))
+ (if (looking-at ruby-modifier-re)
+ (ruby-expr-beg 'modifier)
+ t))
+ t)
+ (goto-char pnt)
+ (setq nest (cons (cons nil pnt) nest))
+ (setq depth (1+ depth)))
+ (goto-char pnt))
+ ((looking-at ruby-block-beg-re)
+ (and
+ (or (not (looking-at "do\\>[^_]"))
+ (save-excursion
+ (back-to-indentation)
+ (not (looking-at ruby-non-block-do-re))))
(or (bolp)
(progn
(forward-char -1)
@@ -462,7 +499,7 @@ The variable ruby-indent-level controls the amount of indentation.
(goto-char (cdr (nth 1 state)))
(forward-word -1) ; skip back a keyword
(cond
- ((looking-at "do") ; iter block is a special case
+ ((looking-at "do\\>[^_]") ; iter block is a special case
(cond
((nth 3 state)
(goto-char (nth 3 state))