summaryrefslogtreecommitdiff
path: root/misc/ruby-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'misc/ruby-mode.el')
-rw-r--r--misc/ruby-mode.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index c07fdbb536..25c6b3008d 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -18,7 +18,7 @@
)
(defconst ruby-non-block-do-re
- "\\(while\\|until\\|for\\|rescue\\)\\>"
+ "\\(while\\|until\\|for\\|rescue\\)\\>[^_]"
)
(defconst ruby-indent-beg-re
@@ -45,7 +45,7 @@
(concat ruby-modifier-beg-re "\\|" ruby-block-op-re)
)
-(defconst ruby-block-end-re "end")
+(defconst ruby-block-end-re "\\<end\\>")
(defconst ruby-here-doc-beg-re
"<<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)")
@@ -61,13 +61,13 @@
(defconst ruby-delimiter
(concat "[?$/%(){}#\"'`.:]\\|<<\\|\\[\\|\\]\\|\\<\\("
ruby-block-beg-re
- "\\|" ruby-block-end-re
- "\\)\\>\\|^=begin\\|" ruby-here-doc-beg-re)
+ "\\)\\>\\|" ruby-block-end-re
+ "\\|^=begin\\|" ruby-here-doc-beg-re)
)
(defconst ruby-negative
- (concat "^[ \t]*\\(\\(" ruby-block-mid-re "\\)\\>\\|\\("
- ruby-block-end-re "\\)\\>\\|}\\|\\]\\)")
+ (concat "^[ \t]*\\(\\(" ruby-block-mid-re "\\)\\>\\|"
+ ruby-block-end-re "\\|}\\|\\]\\)")
)
(defconst ruby-operator-chars "-,.+*/%&|^~=<>:")
@@ -383,7 +383,7 @@ The variable ruby-indent-level controls the amount of indentation.
(t
(setq in-string (point))
(goto-char end))))
- ((looking-at "/=")
+ ((looking-at "/=")
(goto-char pnt))
((looking-at "/")
(cond
@@ -454,7 +454,7 @@ The variable ruby-indent-level controls the amount of indentation.
(setq depth (1- depth)))
(setq nest (cdr nest))
(goto-char pnt))
- ((looking-at (concat "\\<\\(" ruby-block-end-re "\\)\\>"))
+ ((looking-at ruby-block-end-re)
(if (or (and (not (bolp))
(progn
(forward-char -1)
@@ -782,7 +782,8 @@ An end of a defun is found by moving forward from the beginning of one."
(defun ruby-move-to-block (n)
(let (start pos done down)
(setq start (ruby-calculate-indent))
- (setq down (looking-at (concat "\\<\\(" (if (< n 0) ruby-block-end-re ruby-block-beg-re) "\\)\\>")))
+ (setq down (looking-at (if (< n 0) ruby-block-end-re
+ (concat "\\<\\(" ruby-block-beg-re "\\)\\>"))))
(while (and (not done) (not (if (< n 0) (bobp) (eobp))))
(forward-line n)
(cond
@@ -893,7 +894,7 @@ An end of a defun is found by moving forward from the beginning of one."
(?:
(forward-char -1)
(eq (char-before) :)))))
- (if (looking-at (concat "\\<\\(" ruby-block-end-re "\\)\\>"))
+ (if (looking-at ruby-block-end-re)
(ruby-beginning-of-block))
nil))
(setq i (1- i)))