views:

84

answers:

1

Hello,

I just started playing about with emacs yesterday for a project I'm working on. Anyway, i've started using the nxhtml-mumamo for web dev work and have got everything working alright except for when an HTML attribute contains is written as such...

<element attribute="<?= _ID ?>"></element>

... which invalidates the source. I've found that enabling mumamo-alt-php-tags-mode sorts this problem, and now I'm looking at how to automatically execute this whenever a .php / .html file is opened. I know that this is done through my ~/.emacs file, however as I'm already executing nxhtml-mumamo when opening this file I'm not sure how to run another function.

Any help?

Cheers in advance.

+2  A: 

Something like this:

(add-hook 'nxhtml-mumamo-mode-hook (lambda () (mumamo-alt-php-tags-mode 1)))

This will cause all buffers in nxhtml-mumamo-mode to also be in the mumamo-alt-php-tags-mode, if you want to restrict it to just .html and .php buffers, you'd add something a little more involved like this:

(add-hook 'nxhtml-mumamo-mode-hook 'enable-alt-tags-in-certain-files)
(defun enable-alt-tags-in-certain-files ()
  "enable mumamo-alt-php-tags-mode in .php and .html files"
  (when (string-match "\\.php$\\|\\.html\\$" (buffer-file-name))
    (mumamo-alt-php-tags-mode 1)))
Trey Jackson
That's perfect, thanks. I'm going to go with the first for now as it's exactly what I'm looking for, but thanks for the extended version.I'd upvote if I could, but I'm still a newbie.
papercup
Even without the minimal reputation for upvoting, you can accept answers to questions you've asked.
Trey Jackson