5

I downloaded nxhtml and unzip it. I then put this in my .emacs file.

(add-to-list 'load-path "~/nxhtml/util")
    (require 'mumamo-fun)
    (setq mumamo-chunk-coloring 'submode-colored)
    (add-to-list 'auto-mode-alist '("\\.rhtml\\'" . eruby-nxhtml-mumamo-mode))
    (add-to-list 'auto-mode-alist '("\\.html\\.erb\\'" . eruby-nxhtml-mumamo-mode))

When I open an .html.erb file it does not have the proper mode set(and therefore improper syntax highlighting). I know the require statement is running correctly b/c I can manually set aquamacs to eruby-nxhtml-mumamo-mode and if I comment out the require line I can't even switch to that mode. I have even tried replacing the eruby...-mode with other modes like c++-mode and other modes I know work and that doesn't work either.

So is my problem with the regex? I am not sure. Any help would be appreciated.

SteVwonder
  • 175
  • 1
  • 1
  • 8
  • I can't see anything wrong with your code, and experimentally it works for me (with a different mode specified). When you say you don't end up in the proper mode, which mode *do* you end up in? Perhaps another mapping was taking precedence. – phils May 03 '12 at 06:58

1 Answers1

1

Try the following:

(add-to-list 'auto-mode-alist '("\\.rhtml?$" . eruby-nxhtml-mumamo-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\.erb$" . eruby-nxhtml-mumamo-mode))

It appears you had an escaped comma at the end of your expressions.

I don't know if the lack of the 'l' in your header was intentional or not, but the question mark should account for it either way. The dollar sign anchors the expression to the end of the string, and are nominally optional, but it's nice to be explicit.

angelixd
  • 300
  • 1
  • 7
  • "When matching a string instead of a buffer, `$` matches at the end of the string or before a newline character." whereas "`\'` matches the empty string, but only at the end of the buffer or string being matched against." In other words, `\'` definitely matches the end of the string, whereas `$` may not if there is a newline. The difference is incredibly unlikely to ever be an issue when it comes to filenames, but I would still favour using `\'`. – phils May 03 '12 at 06:53