html - 在 Aquamacs 中默认禁用 html-helper-mode 以编辑 HTML

标签 html emacs elisp aquamacs

Aquamacs 有一个默认的 html-helper-mode 来编辑具有奇怪行为的 .html 文件。我想默认切换回常规 html-mode

我读到我需要更改 magic-mode-alist 才能这样做。 据我了解 documentation , 将其添加到我的 .emacs 应该可以解决问题:

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

不幸的是,它并没有改变任何东西。 我读了elsewhere将其设置为 nil 应该可以,但也没有。

知道我错过了什么吗?

提前致谢。

最佳答案

根据the page I linked ,第一个要修改的变量是 magic-mode-alist,它优先于 auto-mode-alist

我只是在匹配列表的开头添加了一个值,使用与 magic-mode-alist 中完全相同的正则表达式指向 html-helper-mode:

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

像魅力一样工作。享受 Aquamacs 而不用担心 html-helper-mode

关于html - 在 Aquamacs 中默认禁用 html-helper-mode 以编辑 HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14032801/

相关文章:

emacs - 在 evil-mode 下绑定(bind) C-z 以逃至 shell

emacs - 组织模式:抽屉的可见导出

在 Emacs Lisp 中解析

emacs make-frame 在恢复之前不会在当前显示器上显示框架

html - 将链接 div 移到标语 p 上方的 h1 旁边

javascript - 根据使用 jQuery 动态生成的 html 动态添加 html

html - 引导行中的辅助可滚动列表被隐藏

javascript - A 型框按钮 onClick 更改对象

Emacs .dir-locals.el - 设置键绑定(bind)

emacs - 在 emacs 中处理多个同名文件的最佳方法是什么?