[OS X Emacs] Mode doesn't start as default for html files

David Reitter david.reitter at gmail.com
Mon Apr 13 15:59:39 EDT 2015


Hi Eduardo,

On Apr 7, 2015, at 10:05 PM, Eduardo San Miguel <eduardo at simplej.com> wrote:

> I can't get Aquamacs to start by default with a mode I installed (web-mode to be precise). I have asked in stackoverflow and was recommended to post to this mailing list:

There is nothing in the code to posted that would cause Aquamacs to start up in web-mode by default.

> Also I have noticed that web-mode works only when creating a new html file.


The code you have included could work fine in principle, except that it ignores the customization setting in `magic-mode-alist’.  This will automatically load html-helper-mode if the file is recognized as HTML by its contents (as opposed to by its file name).  This setting overrides yours.

The following piece of code can remove the problematic entry from magic-mode-alist for you:

(setq magic-mode-alist (cl-remove-if (lambda (x) (eq 'html-helper-mode (cdr x))) magic-mode-alist))

Does that help?

By the way, I worked out this answer because you posted to the mailing list several times, and I failed to see Marc Shapiro’s correct answer.  I’m sending this as an alternative solution for the record.

> What a bummer it doesn't work in an easier way for such a commmon file type. Thanks for the help! I'd had this issue for such a long time...

Well, for such common file types (XML and HTML), Aquamacs is configured to recognize the code by content for the convenience of the user.  I realize that this means that overly simplistic installation instructions from other packages will no longer be correct.  I’m do not know a clean solution to this dilemma.

Best
- David

--
http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project!


More information about the MacOSX-Emacs mailing list