我正在使用Emacs 23和php-mode.el 1.5.0。当我把这个放在我的.emacs里
(require 'php-mode)当Emacs启动时,我会收到以下错误消息:
警告(初始化):加载
/Users/kdj/.emacs': error:c-lang-defconst‘时发生错误,必须在文件中使用。 为了确保正常操作,您应该调查并删除初始化文件中错误的原因。使用‘-调试-init’选项启动Emacs,以查看完整的错误回溯。
如果在Emacs启动后评估(require 'php-mode),则不会收到任何错误消息。
我发现了一个博客条目,它表明这个问题是Emacs 23特有的(也就是说,Emacs22.x没有错误),但是它没有给出任何解决方案。
我不知道这是否重要,但我使用的是matters,我使用./configure --with-ns从当前的CVS源代码构建了Emacs。
这是怎么回事,还有/或我怎么能修好它?
发布于 2009-05-27 20:02:04
我遇到了同样的问题,当我试图使csharp启动和运行。我最终找到了解决方案时,深入实际的Emacs文件的csharp:
;; This code doesn't seem to work when you compile it, then
;; load/require in the Emacs file. You will get an error (error
;; "`c-lang-defconst' must be used in a file") which happens because
;; cc-mode doesn't think it is in a buffer while loading directly
;; from the init. However, if you call it based on a file extension,
;; it works properly. Interestingly enough, this doesn't happen if
;; you don't byte-compile cc-mode.因此,将快速和肮脏的修复放入您的.emacs是自动加载在扩展,而不是把(require 'php-mode)或(load "php-mode")在那里。没有进一步的担心,
(autoload 'php-mode "php-mode" "Major mode for editing php code." t)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$" . php-mode))我希望这能帮到你!现在,我只需要让PHP/HTML模式转换工作。祝我好运吧。
发布于 2010-03-16 19:49:23
它在http://mewde.googlecode.com/files/php-mode-new.el中运行得很好。
https://stackoverflow.com/questions/898063
复制相似问题