2009-11-18 33 views
2

我一直同時在Ubuntu上Emacs23使用PHP模式得到這個錯誤和類似的錯誤: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 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 starter kit,它捆綁了nxhtml版本。我嘗試使用php-mode-1.5.0仍然沒有成功。我甚至嘗試使用最新版本的nxhtml(2.2),但仍然存在相同的錯誤。我不得不復制並粘貼 所有從mewde中缺失的函數定義,以便它以相對的理性工作。我不得不說,它確實增加了一些價值。 :)

有趣的事情,這個問題似乎是對我來說,我使用的在openSUSE 11.0和11.1 Emacs的同樣的東西沒有一個單一的問題,Ubuntu的業報唯一的問題。

謝謝。

回答

1

的問題是,一些試圖調用未定義功能'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)))) 

但是,解決由切割從intertubes /粘貼隨機碼你的問題不是一個很好的長期解決方案。

+0

我已經用必要的信息更新了問題。我已經合併了php-mode.el,我已經將它與一個定義了所有這些函數的函數合併在一起,並且它似乎迄今爲止工作正常,並且存在一些問題。我不知道的是,爲什麼我似乎是唯一有這個問題的人,即使使用emacs22,也只有在Ubuntu Karmic中,我在opensuse 11.0和11.1上的emacs上使用了相同的東西,沒有出現任何問題。 – partoa 2009-11-19 09:09:45

+0

很有可能,您在opensuse上使用的Emacs有不同的東西捆綁在一起。原來的錯誤是因爲一個函數沒有被定義。它不是Emacs的一部分(不管操作系統如何),所以在這兩個系統上安裝了不同的支持庫。 – 2009-11-19 13:56:19

+0

我想。我甚至嘗試用來自source僞造的一個來改變cc模式,以查看會發生什麼,仍然發生同樣的錯誤。我對Elisp不熟悉,否則我會選擇調試底層系統,所以它不必調用未定義的函數,或者它不會拋出錯誤,就像opensuse一樣。無論如何,這個問題現在已經解決了。感謝您的答覆。 – partoa 2009-11-20 11:32:22