From 94d2fc1815a919734353c942f224db1de4b4fcb8 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 7 Mar 2011 09:04:49 +0100 Subject: Django, org * Added nxhtml, mostly for django support. * Changed some org settings. --- emacs.d/nxhtml/tests/in/emacswiki-erb-bug.el | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 emacs.d/nxhtml/tests/in/emacswiki-erb-bug.el (limited to 'emacs.d/nxhtml/tests/in/emacswiki-erb-bug.el') diff --git a/emacs.d/nxhtml/tests/in/emacswiki-erb-bug.el b/emacs.d/nxhtml/tests/in/emacswiki-erb-bug.el new file mode 100644 index 0000000..4e565ef --- /dev/null +++ b/emacs.d/nxhtml/tests/in/emacswiki-erb-bug.el @@ -0,0 +1,36 @@ +;;; This file is from a link on EmacsWiki to http://paste.lisp.org/display/59495 +;; +;; As far as I can see this is a ruby-mode bug, not a mumamo bug. + +;;; The problem is that when a ruby ERB template is loaded with an +;;; after-hook that modifies the font-lock keywords, nxhtml causes +;;; font-lock not to occur on strings and comments. What's more is +;;; this affects regular ruby-mode as well, not just within mumamo. + +(require 'ruby-mode) + +;; Extra keyword fontification for ruby +(defun emacswiki-erb-bug-keywords () + (font-lock-add-keywords nil + '(("\\<\\(FIX\\|TODO\\|FIXME\\|HACK\\|REFACTOR\\):" + 1 font-lock-warning-face t)))) + +;; Adding the extra keywords at the beginning of ruby-mode-hook breaks +;; ruby-mode fontification (use the test case at the bottom): +(add-hook 'ruby-mode-hook 'emacswiki-erb-bug-keywords) +;; removing this hook makes it not break anymore: +(remove-hook 'ruby-mode-hook 'emacswiki-erb-bug-keywords) +;; However adding the extra keywords at the end of the hook works fine: +(add-hook 'ruby-mode-hook 'emacswiki-erb-bug-keywords t) + + +;; run this to test: +(progn + (find-file "bar.rb") + (insert "# Comments should be font-locked, but are not. +class Bar + def baz + \"strings should also be font-locked but are not.\" + end +end")) + -- cgit v1.2.3-54-g00ecf