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.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index d51e8c9..21e1b46 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 "-,.+*/%&|^~=<>:")
@@ -452,7 +452,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)
@@ -780,7 +780,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
@@ -891,7 +892,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)))