1 ;;; This file is from a link on EmacsWiki to http://paste.lisp.org/display/59495
3 ;; As far as I can see this is a ruby-mode bug, not a mumamo bug.
5 ;;; The problem is that when a ruby ERB template is loaded with an
6 ;;; after-hook that modifies the font-lock keywords, nxhtml causes
7 ;;; font-lock not to occur on strings and comments. What's more is
8 ;;; this affects regular ruby-mode as well, not just within mumamo.
12 ;; Extra keyword fontification for ruby
13 (defun emacswiki-erb-bug-keywords ()
14 (font-lock-add-keywords nil
15 '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):"
16 1 font-lock-warning-face t))))
18 ;; Adding the extra keywords at the beginning of ruby-mode-hook breaks
19 ;; ruby-mode fontification (use the test case at the bottom):
20 (add-hook 'ruby-mode-hook 'emacswiki-erb-bug-keywords)
21 ;; removing this hook makes it not break anymore:
22 (remove-hook 'ruby-mode-hook 'emacswiki-erb-bug-keywords)
23 ;; However adding the extra keywords at the end of the hook works fine:
24 (add-hook 'ruby-mode-hook 'emacswiki-erb-bug-keywords t)
30 (insert "# Comments should be font-locked, but are not.
33 \"strings should also be font-locked but are not.\"