因此,为了优化 emacs 启动时间,我更喜欢将所有 mod 封装在钩子(Hook)或加载后评估中。所以我想出了 python、cpp 和 latex,但我仍然坚持使用 nXhtml。我尝试了以下方法:
(eval-after-load "HTML-mode"
'(progn
(load-file "~/.emacs.d/plugins/nxhtml/autostart.el")
))
这根本不起作用。
代码:
(add-hook 'html-mode-hook (lambda()
(progn
(load-file "~/.emacs.d/plugins/nxhtml/autostart.el")
)))
加载了 nXhtml 的某些部分,但 nXhtml 模式未打开(仅 SGML 和 AC),因此范围在我的 php 源代码中没有不同颜色或自动完成/括号完成不起作用。
它正常工作的唯一方法是让它在启动时加载。
查看跟踪,在启动期间加载 nxhtml 时,它说:
"majmodpri-apply-priorities running ... (done)"
然而,当负载被 n html-mode-hook 或 eval-after-load 封装时,跟踪显示:
"majmodpri-apply-priorities running ... MU:majmodpri-check changing majmodpri-apply-priorities: buffer=index.php, html-mode,nil => sgml-mode,nil majmodpri-apply-priorities running ... (done)"
有什么想法吗?
最佳答案
我认为 nXhtml 的自动启动文件(这是您要加载的所有文件)被设计为相当小,所以您可能无法在不限制其某些功能的情况下将其减少太多?
实际需要多长时间?看起来应该记录了一条“Nxml/Nxhtml Autostart.el 在 %.1f 秒内加载”消息。
关于html - 如何让 emacs 仅在打开 php/html 文件时加载 nXhtml 并阻止它在启动时加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10356238/