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.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 13571dec5f9..6750035e710 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -781,9 +781,10 @@ An end of a defun is found by moving forward from the beginning of one."
'(lambda ()
(make-local-variable 'font-lock-defaults)
(make-local-variable 'font-lock-keywords)
- (make-local-variable 'font-lock-syntactic-keywords)
+ (make-local-variable 'font-lock-syntax-table)
(setq font-lock-defaults '((ruby-font-lock-keywords) nil nil))
(setq font-lock-keywords ruby-font-lock-keywords)
+ (setq font-lock-syntax-table ruby-font-lock-syntax-table)
(setq font-lock-syntactic-keywords ruby-font-lock-syntactic-keywords)))))
(defun ruby-font-lock-docs (limit)
@@ -812,6 +813,11 @@ An end of a defun is found by moving forward from the beginning of one."
t)
nil)))
+ (defvar ruby-font-lock-syntax-table
+ (let* ((tbl (copy-syntax-table ruby-mode-syntax-table)))
+ (modify-syntax-entry ?_ "w" tbl)
+ tbl))
+
(defvar ruby-font-lock-keywords
(list
(cons (concat
@@ -855,10 +861,10 @@ An end of a defun is found by moving forward from the beginning of one."
"yield"
)
"\\|")
- "\\)\\>\\([^_]\\|$\\)")
+ "\\)\\>")
2)
;; variables
- '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\b\\([^_]\\|$\\)"
+ '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>"
2 font-lock-variable-name-face)
;; variables
'("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W"