I'm using version 2.1 of Aquamacs and django-mode from https://github.com/myfreeweb/django-mode. I installed it (after installing yasnippets) by adding
(require 'django-html-mode)
(require 'django-mode)
(yas/load-directory "path-to/django-mode/snippets")
(add-to-list 'auto-mode-alist '("\\.djhtml$" . django-html-mode))
to my .emacs file. But sometimes Aquamacs uses the standard HTML mode instead of django-html-mode. This happens whenever a file starts with an html tag.
What do I have to change to make Aquamacs prioritize the file's extension instead of it's content (at least for .djthml files - everything else works just fine)?
Check magic-mode-alist
and magic-fallback-mode-alist
(although the latter shouldn't be applied if the file extension is in auto-mode-alist
). You also need to watch out for case; Emacs is likely to consider FOO.DJHTML
to not match "\\.djhtml"
. I don't have Aquamacs installed, but Emacs.app has HTML recognition regexps in magic-fallback-mode-alist
.
BTW, if it is case sensitivity, change the auto-mode-alist
line to
(add-to-list 'auto-mode-alist '("\\.[Dd][Jj][Hh][Tt][Mm][Ll]$" . django-html-mode))