当我在Ubuntu上的Emacs23上使用php-mode时,我一直收到这个错误和类似的错误:
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(结尾的内容(例如is_array( )时出现以下错误
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)即使我使用emacs初学者工具包,也会引发此错误。有人解决了类似的问题吗?
我使用的php-mode.el来自捆绑了nxhtml版本的emacs starter kit。我尝试使用php-mode-1.5.0仍然没有成功。我甚至尝试使用最新版本的nxhtml(2.2),但同样的错误仍然存在。我必须复制并粘贴mewde中缺失的所有函数定义,才能相对正常地工作。我不得不说,它确实增加了一些价值。:)
有趣的是,这个问题似乎只是我的Ubuntu业力问题,我在opensuse 11.0和11.1上的emacs上使用了相同的东西,没有一个问题。
谢谢。
发布于 2009-11-19 01:58:01
问题是有些东西试图调用未定义的函数'php-template-if-hook。
如果您提供了一个指向您正在使用的php-mode.el的链接,这将非常有用,因为那里似乎有several。
符号'php-template-if-hook不是sourceforge上的php-mode.el的一部分,所以您可能有一个不同的版本,或者您的.emacs中有其他东西导致了这个问题。看起来好像有什么东西触发了一个指向'php-template-if-hook‘的缩写插入。注意:堆栈溢出上的it looks like用户正在使用来自sourceforge的php模式,所以我建议使用该模式。
用谷歌快速搜索一下,就会找到这个php-mode.el,它将'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))))但是,通过从内部剪切/粘贴随机代码来解决问题并不是一个好的长期解决方案。
https://stackoverflow.com/questions/1755785
复制相似问题