From f145325797ef784b633ada53034abc4735e7912c Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 2 May 2008 06:01:13 +0000 Subject: [PATCH] * misc/ruby-mode.el: move fontifying code from hook. [ruby-core:16636] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ misc/ruby-mode.el | 30 ++++++++++++------------------ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7cb03675c2..a43e03965d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri May 2 14:52:33 2008 Yukihiro Matsumoto + + * misc/ruby-mode.el: move fontifying code from hook. + [ruby-core:16636] + Fri May 2 14:10:17 2008 Yukihiro Matsumoto * range.c (range_step): step may be bignum. diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el index 6d54440b20..138b1b9b2b 100644 --- a/misc/ruby-mode.el +++ b/misc/ruby-mode.el @@ -307,6 +307,11 @@ The variable ruby-indent-level controls the amount of indentation. ((boundp 'write-contents-hooks) 'write-contents-hooks)) 'ruby-mode-set-encoding) + (set (make-local-variable 'font-lock-defaults) '((ruby-font-lock-keywords) nil nil)) + (set (make-local-variable 'font-lock-keywords) ruby-font-lock-keywords) + (set (make-local-variable 'font-lock-syntax-table) ruby-font-lock-syntax-table) + (set (make-local-variable 'font-lock-syntactic-keywords) ruby-font-lock-syntactic-keywords) + (run-mode-hooks 'ruby-mode-hook)) (defun ruby-current-indentation () @@ -1101,24 +1106,13 @@ balanced expression is found." ("^\\(=\\)begin\\(\\s \\|$\\)" 1 (7 . nil)) ("^\\(=\\)end\\(\\s \\|$\\)" 1 (7 . nil)))) - (cond ((featurep 'xemacs) - (put 'ruby-mode 'font-lock-defaults - '((ruby-font-lock-keywords) - nil nil nil - beginning-of-line - (font-lock-syntactic-keywords - . ruby-font-lock-syntactic-keywords)))) - (t - (add-hook 'ruby-mode-hook - '(lambda () - (make-local-variable 'font-lock-defaults) - (make-local-variable 'font-lock-keywords) - (make-local-variable 'font-lock-syntax-table) - (make-local-variable 'font-lock-syntactic-keywords) - (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))))) + (if (featurep 'xemacs) + (put 'ruby-mode 'font-lock-defaults + '((ruby-font-lock-keywords) + nil nil nil + beginning-of-line + (font-lock-syntactic-keywords + . ruby-font-lock-syntactic-keywords)))) (defun ruby-font-lock-docs (limit) (if (re-search-forward "^=begin\\(\\s \\|$\\)" limit t)