summaryrefslogtreecommitdiff
path: root/sample/ruby-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'sample/ruby-mode.el')
-rw-r--r--sample/ruby-mode.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el
index 4396b1098d..20e1abebc9 100644
--- a/sample/ruby-mode.el
+++ b/sample/ruby-mode.el
@@ -8,7 +8,7 @@
;;;
(defconst ruby-block-beg-re
- "class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin"
+ "class\\|module\\|def\\|if\\|case\\|while\\|for\\|begin"
)
(defconst ruby-block-mid-re
@@ -170,10 +170,14 @@ The variable ruby-indent-level controls the amount of indentation.
((or (string= "\"" w) ;skip string
(string= "'" w)
(string= "`" w))
- (if (search-forward w indent-point t)
- nil
+ (cond
+ ((string= w (char-to-string (char-after (point))))
+ (forward-char 1))
+ ((re-search-forward (format "[^\\]%s" w) indent-point t)
+ nil)
+ (t
(goto-char indent-point)
- (setq in-string t)))
+ (setq in-string t))))
((or (string= "/" w)
(string= "<" w))
(if (string= "<" w) (setq w ">"))
@@ -189,7 +193,9 @@ The variable ruby-indent-level controls the amount of indentation.
(and (eq c ?w)
(save-excursion
(forward-word -1)
- (looking-at ruby-block-beg-re))))
+ (or
+ (looking-at ruby-block-beg-re)
+ (looking-at ruby-block-mid-re)))))
(if (search-forward w indent-point t)
nil
(goto-char indent-point)