# Ruby syntax highlighting problem with Emacs

**URL:** <https://www.ruby-forum.com/t/ruby-syntax-highlighting-problem-with-emacs/51710>\
**Category:** Ruby\
**Created:** [January 6, 2006, 5:37am UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighting-problem-with-emacs/51710 "2006-01-06T05:37:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/35a633/32.png) [@rich](https://www.ruby-forum.com/u/rich)\
**Post date:** [January 6, 2006, 5:37am UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighting-problem-with-emacs/51710/1 "2006-01-06T05:37:17Z")

</div>

I was attempting to install ruby support into my emacs installation by  
following the directions at the RubyGarden. When I load a ruby file,  
Emacs switches to Ruby mode but doesn’t do syntax highlighting. Does  
anybody have any insight? Here is the relevant portion of my .emacs  
file:

(autoload 'ruby-mode “ruby-mode”  
“Mode for editing ruby source files”)  
(add-to-list 'auto-mode-alist ‘("\.rb\’" . ruby-mode))  
(add-hook 'ruby-mode-hook 'turn-on-font-lock) ;; \<- Is supposed to  
enable font lock.

(setq interpreter-mode-alist (append '(("^#!.\*ruby" . ruby-mode))  
interpreter-mode-alist))

(setq ruby-indent-level 4)

I do not have ruby-electric.el installed, for the interested. Thank  
you.

-Rich

---

<div class="post-metadata">

**Author:** ![rich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/35a633/32.png) [@rich](https://www.ruby-forum.com/u/rich)\
**Post date:** [January 6, 2006, 6:16am UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighting-problem-with-emacs/51710/2 "2006-01-06T06:16:20Z")

</div>

On Fri, Jan 06, 2006 at 01:35:38PM +0900, Rich wrote:

> When I load a ruby file, Emacs switches to Ruby mode but doesn’t do  
> syntax highlighting. Does anybody have any insight?

Perhaps you need to turn syntax highlighting on in general:

(global-font-lock-mode 1)

---

<div class="post-metadata">

**Author:** ![rich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/35a633/32.png) [@rich](https://www.ruby-forum.com/u/rich)\
**Post date:** [January 6, 2006, 3:08pm UTC](https://www.ruby-forum.com/t/ruby-syntax-highlighting-problem-with-emacs/51710/3 "2006-01-06T15:08:48Z")

</div>

That did it. Thank you very much.
