我昨天刚开始为我正在从事的项目使用 emacs。无论如何,我已经开始使用 nxhtml-mumamo 进行 Web 开发工作并且一切正常,除了当 HTML 属性包含这样写时......
<element attribute="<?= _ID ?>"></element>
... 使来源无效。 我发现启用 mumamo-alt-php-tags-mode 可以解决这个问题,现在我正在研究如何在打开 .php/.html 文件时自动执行它。我知道这是通过我的 ~/.emacs 文件完成的,但是由于我在打开此文件时已经在执行 nxhtml-mumamo,所以我不确定如何运行另一个函数。
有什么帮助吗?
提前干杯。
最佳答案
像这样:
(add-hook 'nxhtml-mumamo-mode-hook (lambda () (mumamo-alt-php-tags-mode 1)))
如果你想将它限制为只是 .html
和 .php
缓冲区,你可以像这样添加一些更复杂的东西:
(add-hook 'nxhtml-mumamo-mode-hook 'enable-alt-tags-in-certain-files)
(defun enable-alt-tags-in-certain-files ()
"enable mumamo-alt-php-tags-mode in .php and .html files"
(when (string-match "\\.php$\\|\\.html\\$" (buffer-file-name))
(mumamo-alt-php-tags-mode 1)))
关于php - mumamo-alt-php-tags-mode 默认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1910115/