首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使php模式(和其他cc模式派生模式)与Emacs 23兼容。

使php模式(和其他cc模式派生模式)与Emacs 23兼容。
EN

Stack Overflow用户
提问于 2009-05-22 14:10:45
回答 2查看 12.9K关注 0票数 29

我正在使用Emacs 23和php-mode.el 1.5.0。当我把这个放在我的.emacs

代码语言:javascript
复制
(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。

这是怎么回事,还有/或我怎么能修好它?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2009-05-27 20:02:04

我遇到了同样的问题,当我试图使csharp启动和运行。我最终找到了解决方案时,深入实际的Emacs文件的csharp:

代码语言:javascript
复制
;;   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")在那里。没有进一步的担心,

代码语言:javascript
复制
(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模式转换工作。祝我好运吧。

票数 51
EN

Stack Overflow用户

发布于 2010-03-16 19:49:23

它在http://mewde.googlecode.com/files/php-mode-new.el中运行得很好。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/898063

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档