【问题标题】:mumamo-alt-php-tags-mode by defaultmumamo-alt-php-tags-mode 默认情况下
【发布时间】:2010-12-26 23:26:34
【问题描述】:

我昨天刚开始为我正在做的一个项目使用 emacs。无论如何,我已经开始使用 nxhtml-mumamo 进行网络开发工作,并且一切正常,除非 HTML 属性包含这样编写......

<element attribute="<?= _ID ?>"></element>

... 使源无效。 我发现启用 mumamo-alt-php-tags-mode 可以解决这个问题,现在我正在研究如何在打开 .php / .html 文件时自动执行它。我知道这是通过我的 ~/.emacs 文件完成的,但是由于我在打开此文件时已经在执行 nxhtml-mumamo,所以我不确定如何运行另一个函数。

有什么帮助吗?

提前干杯。

【问题讨论】:

    标签: php html emacs


    【解决方案1】:

    类似这样的:

    (add-hook 'nxhtml-mumamo-mode-hook (lambda () (mumamo-alt-php-tags-mode 1)))
    

    这将导致nxhtml-mumamo-mode 中的所有缓冲区也位于mumamo-alt-php-tags-mode 中,如果您想将其限制为仅.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)))
    

    【讨论】:

    • 太好了,谢谢。我现在将使用第一个,因为它正是我正在寻找的,但感谢扩展版本。如果可以的话,我会投票,但我还是个新手。
    • 即使在点赞方面名声不佳,您也可以接受所提问题的答案。
    猜你喜欢
    • 2012-02-29
    • 2010-12-02
    • 2012-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-07
    • 2016-05-13
    相关资源
    最近更新 更多