From: Josh Huber Date: 2004-03-17T01:24:58+09:00 Subject: Re: ruby-mode.el - font lock not working? It seems as though I was pretty confused, since in XEmacs C-h a searches all symbols, while in GNU Emacs it only searches interactive commands. No wonder I couldn't find these functions/variables :) btw, this is with Emacs 21.3.50.1. "Josef 'Jupp' SCHUGT" writes: > $ emacs --version|head -1 > GNU Emacs 21.2.1 > > Start, enter > > M-x describe-mode font-lock-mode > > which among other information displays: > > You can enable Font Lock mode in any major mode automatically by > turning on in the major mode's hook. For example, put in your > ~/.emacs: > > (add-hook 'c-mode-hook 'turn-on-font-lock) > > Switch to *scratch* > > M-x lisp-mode > > No highlighting here. Enter > > (add-hook 'lisp-mode-hook 'turn-on-font-lock) > > enter > > M-x eval-current-buffer > > again enter > > M-x lisp-mode > > Voila`: Syntax highlighting. Unfortunately, my problem is that in ruby-mode, even when syntax highlighting is enabled, it doesn't work until I toggle font-lock off, then back on again. It seems as though if I have: (global-font-lock-mode 1) (add-hook 'ruby-mode-hook 'turn-on-font-lock) (setq font-lock-maximum-decoration t) *before* I load ruby-mode, then things work as expected, otherwise I need to toggle font-lock off, then on to make it work. > [... font-lock-maximum-decoration ...] > It definitely works in GNU Emacs. Checked with tex-mode. nil > arguments to textbf (i.e. bold face) display in ordinary face, if > set to t they display in bold face. Yes, I see that now. After reordering as I mentioned above, it seems to have done the trick. > You know that the setting to take effect you need to do a > font-lock-mode cycle (i.e. switch it of and on again). perhaps this has something to do with it? > Did I point out that my favorite editor is vim and that I *very* > rarely use GNU Emacs? I use vim quite a bit as well, but not for writing code. I like being able to write elisp to help coding tasks. (of course, I haven't had to do this for Ruby, but when dealing with C it's handy to automate various boring tasks) -- Josh Huber