2
votes

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.

1

1 Answers

2
votes

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)))