Emacs23 php模式问题
在Ubuntu上的Emacs23上使用php模式时,我不断遇到此错误和类似错误:Emacs23 php模式问题,php,emacs,elisp,php-mode,Php,Emacs,Elisp,Php Mode,在Ubuntu上的Emacs23上使用php模式时,我不断遇到此错误和类似错误: Debugger entered--Lisp error: (void-function php-template-if-hook) php-template-if-hook() abbrev-insert(if #("if" 0 2 (fontified t face font-lock-keyword-face)) 414 416) #[(G73404 funs global) "[Byte Cod
Debugger entered--Lisp error: (void-function php-template-if-hook)
php-template-if-hook()
abbrev-insert(if #("if" 0 2 (fontified t face font-lock-keyword-face)) 414 416)
#[(G73404 funs global) "[Byte Code]"
apply(#[(G73404 funs global "[Byte Code]"
(lambda (&rest --cl-rest--) (apply #[... "[Byte Code]"
expand-abbrev()
self-insert-command(1)
c-electric-paren(nil)
call-interactively(c-electric-paren nil nil)
当我键入if(
)时,以及当我键入array(
或任何以array(
结尾的内容时,下面的错误,例如是数组(
):
即使在使用emacs初学者工具包时,也会出现此错误。
有人修复了类似的问题吗
我使用的php-mode.el来自,它捆绑了一个版本的。我尝试使用仍然没有成功。我甚至尝试使用最新版本的nxhtml(2.2),但仍然存在相同的错误。我必须复制和粘贴
所有的函数定义都缺少了,因此它可以相对正常地工作。我不得不说,它确实增加了一些价值。:)
有趣的是,这个问题对我来说似乎是Ubuntu唯一的问题,我在opensuse 11.0和11.1的emacs上使用了相同的东西,没有任何问题
谢谢。问题是有东西试图调用未定义的函数
'php-template-if-hook
如果您提供了一个链接,指向您正在使用的php mode.el
的位置,这将非常有用,因为似乎有
符号'php-template-if-hook
不是sourceforge上的的一部分,因此您可能有不同的版本,或者.emacs中存在导致问题的其他内容。看起来好像有什么东西触发了abbrev插入,导致了“php-template-if-hook
。注意:堆栈溢出的人就是我们正在从sourceforge迁移php模式,因此我建议迁移到该模式
快速的谷歌搜索发现了这一点,它将php-template-if-hook定义为:
(defun php-template-if ()
"Insert an if statement."
(interactive)
(let ((start (point)))
(insert "if ")
(insert "(") ; +
(when (php-template-field "condition" nil t start (point))
(insert ") {") ; +
(newline-and-indent)
(setq start (point-marker))
(insert "\n}")
(php-indent-line-2)
(goto-char start))))
但是,通过剪切/粘贴Intertube中的随机代码来解决您的问题并不是一个好的长期解决方案。我已经用必要的信息更新了这个问题。我已经将我拥有的php-mode.el与一个定义了所有这些函数的php-mode.el合并,到目前为止,它似乎工作得很好,这里和那里都有一些问题我不知道,这就是为什么我似乎是唯一一个有这个问题的人,即使是emacs22,而且只有在Ubuntu Karmic中,我在opensuse 11.0和11.1的emacs上使用了相同的东西,没有一个问题。很可能,你在opensuse上使用的emacs捆绑了不同的东西。最初的错误是因为没有定义函数ed.它不是Emacs的一部分(无论操作系统如何),所以有人在这两个系统上安装了不同的支持库。我想。我甚至试着用source forge中的一个更改cc模式,看看会发生什么,仍然重复出现相同的错误。我不太熟悉Elisp,否则我会选择调试底层系统,所以它不必调用undefined函数,或者它不会像opensuse那样抛出错误。总之,问题现在已经解决了。感谢您的回复。
(defun php-template-if ()
"Insert an if statement."
(interactive)
(let ((start (point)))
(insert "if ")
(insert "(") ; +
(when (php-template-field "condition" nil t start (point))
(insert ") {") ; +
(newline-and-indent)
(setq start (point-marker))
(insert "\n}")
(php-indent-line-2)
(goto-char start))))