Emacs (Aquamacs) 使用错误模式(有时)
我使用的是 Aquamacs 2.1 版和 https://github.com/myfreeweb/django- 的 django-mode模式。我通过添加
(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))
到我的 .emacs 文件来安装它(在安装 yasnippets 之后)。但有时 Aquamacs 使用标准 HTML 模式而不是 django-html-mode。每当文件以 html 标签开头时就会发生这种情况。
我需要更改什么才能使 Aquamacs 优先考虑文件的扩展名而不是其内容(至少对于 .djthml 文件 - 其他一切都正常)?
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查
magic-mode-alist
和magic-fallback-mode-alist
(尽管如果文件扩展名是,则不应应用后者自动模式列表
)。您还需要注意案件; Emacs 可能会认为FOO.DJHTML
不匹配"\\.djhtml"
。我没有安装 Aquamacs,但 Emacs.app 在magic-fallback-mode-alist
中有 HTML 识别正则表达式。顺便说一句,如果区分大小写,请将
auto-mode-alist
行更改为Check
magic-mode-alist
andmagic-fallback-mode-alist
(although the latter shouldn't be applied if the file extension is inauto-mode-alist
). You also need to watch out for case; Emacs is likely to considerFOO.DJHTML
to not match"\\.djhtml"
. I don't have Aquamacs installed, but Emacs.app has HTML recognition regexps inmagic-fallback-mode-alist
.BTW, if it is case sensitivity, change the
auto-mode-alist
line to