简体   繁体   English

Emacs23 php-mode问题

[英]Emacs23 php-mode problem

I keep getting this error and similar errors while using php-mode on Emacs23 on Ubuntu: 在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)

when I type if( , and the error below when I type array( or anything that ends with array( , eg is_array( : 当我键入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)

This error is raised even when I use the emacs starter kit. 即使使用emacs入门套件,也会引发此错误。 Anyone fixed a similar problem? 有人解决过类似的问题吗?

The php-mode.el I use is from the emacs starter kit which bundles a version of nxhtml . 我使用的php-mode.el来自emacs入门套件 ,该套件捆绑了一个nxhtml版本。 I tried using php-mode-1.5.0 still no success. 我尝试使用php-mode-1.5.0仍然没有成功。 I even tried using the latest version of nxhtml(2.2), but still the same error persisted. 我什至尝试使用最新版本的nxhtml(2.2),但仍然存在相同的错误。 I had to copy and paste all the function definitions missing from mewde for it to work with relative sanity. 我必须复制并粘贴mewde缺少的所有函数定义,以使其相对合理地工作。 I have to say that it does add some value though. 我不得不说,它确实增加了一些价值。 :) :)

The funny thing, this problems seems to be an Ubuntu Karmic only problem for me, I was using the same stuff on the emacs on opensuse 11.0 and 11.1 without a single problem. 有趣的是,这个问题对我来说似乎只是一个Ubuntu Karmic问题,我在opensuse 11.0和11.1的emacs上使用了相同的东西,而没有一个问题。

Thanks. 谢谢。

The problem is that something is trying to call the undefined function 'php-template-if-hook . 问题是某些东西试图调用未定义的函数'php-template-if-hook

It'd be useful if you provided a link to where you found the php-mode.el you are using, because there seem to be several . 如果您提供了一个指向正在使用的php-mode.el的链接,这将很有用,因为似乎有多个

The symbol 'php-template-if-hook is not a part of the php-mode.el on sourceforge, so you either have a different version, or there's something else in your .emacs that's causing the problem. 符号'php-template-if-hook不是sourceforge上php-mode.el的一部分,因此您使用的是其他版本,或者.emacs中存在其他导致问题的原因。 It looks as though something is triggering an abbrev insertion that leads to ' php-template-if-hook . 看起来好像是什么触发了缩写插入导致php-template-if-hook Note: it looks like people on stack overflow are using the php-mode from sourceforge, so I'd recommend moving to that one. 注意: 看来堆栈溢出的人正在使用sourceforge的php-mode,所以我建议移至该模式。

A quick google search finds this php-mode.el , which defined 'php-template-if-hook to be: 谷歌快速搜索找到了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))))

But, solving your problem by cutting/pasting random code from the intertubes is not a good long-term solution. 但是,通过从插管中剪切/粘贴随机代码来解决问题并不是一个好的长期解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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