繁体   English   中英

Emacs23 php-mode问题

[英]Emacs23 php-mode problem

在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入门套件 ,该套件捆绑了一个nxhtml版本。 我尝试使用php-mode-1.5.0仍然没有成功。 我什至尝试使用最新版本的nxhtml(2.2),但仍然存在相同的错误。 我必须复制并粘贴mewde缺少的所有函数定义,以使其相对合理地工作。 我不得不说,它确实增加了一些价值。 :)

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

谢谢。

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

如果您提供了一个指向正在使用的php-mode.el的链接,这将很有用,因为似乎有多个

符号'php-template-if-hook不是sourceforge上php-mode.el的一部分,因此您使用的是其他版本,或者.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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM