Search code examples
htmlemacselispaquamacs

Disable html-helper-mode by default in Aquamacs to edit HTML


Aquamacs has a default html-helper-modeto edit .html files that has weird behaviors. I would like to switch back to regular html-mode by default.

I read that I needed to change the magic-mode-alist to do so. From what I understand from the documentation, adding this to my .emacs should do the deal:

(setq magic-mode-alist '(("\\.html" . html-mode)))

Unfortunately it does not change anything. I read elsewhere that setting it to nil should work but it did not either.

Any idea what I am missing?

Thanks in advance.


Solution

  • According the page I linked, the first variable to modify is magic-mode-alist which has precedence on auto-mode-alist.

    I just added a value at the beginning of the list of matches using the exact same regular expression that was in magic-mode-alist pointing to html-helper-mode:

    (add-to-list 'magic-mode-alist 
        '("\\(?:<\\?xml\\s +[^>]*>\\)?\\s *<\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->\\s *<\\)*\\(?:!DOCTYPE\\s +[^>]*>\\s *<\\s *\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->\\s *\<\\)*\\)?[Hh][Tt][Mm][Ll]"
            . html-mode))
    

    Works like a charm. Enjoy Aquamacs without whacky html-helper-mode.