在 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 来自 emacs 入门套件 其中捆绑了一个版本 html. 。我尝试使用 php-模式-1.5.0 仍然没有成功。我什至尝试使用最新版本的 nxhtml(2.2),但仍然存在相同的错误。我必须复制并粘贴所有功能定义 缪德 让它能够相对理智地工作。我不得不说它确实增加了一些价值。:)

有趣的是,这个问题对我来说似乎是 Ubuntu Karmic 唯一的问题,我在 opensuse 11.0 和 11.1 上的 emacs 上使用相同的东西,没有出现任何问题。

谢谢。

有帮助吗?

解决方案

问题是有东西试图调用未定义的函数 'php-template-if-hook.

如果您提供找到该文件的位置的链接,将会很有用 php-mode.el 你正在使用,因为似乎有 一些.

符号 'php-template-if-hook 不属于 php-mode.el 在 sourceforge 上,因此您要么有不同的版本,要么您的 .emacs 中有其他内容导致了问题。看起来好像有什么东西触发了缩写插入,导致 'php-template-if-hook. 笔记: 看起来像 堆栈溢出问题的人们正在使用 sourceforge 的 php-mode,所以我建议转向该模式。

快速谷歌搜索发现了这个 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))))

但是,通过从管间剪切/粘贴随机代码来解决问题并不是一个好的长期解决方案。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top