2013-02-04 26 views
1

.emacs文件具有以下內容:錯誤而載入.emacs文件

$ cat ~/.emacs 
(setq vc-handled-backends nil) 
(global-linum-mode t) 

$ od -xcb ~/.emacs 
0000000  7328 7465 2071 6376 682d 6e61 6c64 6465 
      ( s e t q  v c - h a n d l e d 
      050 163 145 164 161 040 166 143 055 150 141 156 144 154 145 144 
0000020  622d 6361 656b 646e 2073 696e 296c 280a 
      - b a c k e n d s  n i l ) \n (
      055 142 141 143 153 145 156 144 163 040 156 151 154 051 012 050 
0000040  6c67 626f 6c61 6c2d 6e69 6d75 6d2d 646f 
      g l o b a l - l i n u m - m o d 
      147 154 157 142 141 154 055 154 151 156 165 155 055 155 157 144 
0000060  2065 2974             
      e  t )             
      145 040 164 051             
0000064 

這些是絕對有效的Emacs的LISP表達式。 但最近每當我啓動Emacs,行號不再出現,取而代之的是,一個錯誤出現:

$emacs --debug-init ~/.emacs 
Debugger entered--Lisp error: (void-function global-linum-mode) 
    (global-linum-mode t) 
    eval-buffer(#<buffer *load*> nil "/Users/user/.emacs" nil t) ; Reading at buffer position 53 
    load-with-code-conversion("/Users/user/.emacs" "/Users/user/.emacs" t t) 
    load("~/.emacs" t t) 
    #[nil "^H\205\276^@ \306=\203^Q^@\307^H\310Q\202A^@ \311=\2033^@\312\307\313\314#\203#^@\315\202A^@\312\307\313\316$ 
    command-line() 
    normal-top-level() 

版本的Emacs:

$ emacs --version 
GNU Emacs 22.1.1 
Copyright (C) 2007 Free Software Foundation, Inc. 
GNU Emacs comes with ABSOLUTELY NO WARRANTY. 
You may redistribute copies of Emacs 
under the terms of the GNU General Public License. 
For more information about these matters, see the file named COPYING. 

有沒有人有一個想法,什麼可能導致這個? 感謝

+0

你使用的是什麼版本的emacs?我很想知道你是否默認了一個沒有linum模式的emacs版本。 'emacs --version' –

+0

剛剛編輯了該版本的更多信息。 (22.1.1)但正如我所說的那樣,linum模式以前是工作的。 – user1508893

+0

您的平臺上是否有多個emacs(例如/ usr/local/bin/emacs,/ usr/bin/emacs等)?你使用和以前一樣的emacs嗎?請檢查。 – syohex

回答

2

看起來像linum模式已被添加到Emacs版本23.1(changelog)中。由於linum不是隨Emacs 22一起發佈的,因此您正在調用未定義的函數,因此發生錯誤。

也許你曾經運行過一個更新版本的emacs,它已經被破壞了。你既可以:

  • 下載亞麻源,將其添加到您的負載路徑,然後require

  • 安裝的Emacs的新版本。


編輯:由於在評論上面提到的,你可以有你的路徑上的多個Emacs的二進制文件,以不同的版本。看看/usr/bin,/opt/local/bin等,看看是否屬於這種情況。

+0

user1508893:Emacs 22.1的歷史可以追溯到2007年;你幾乎肯定要升級(當前版本是24.2)。 – phils

+0

安裝新版本。謝謝 – user1508893

0

我會比其他cat一些檢查文件的內容,如八進制轉儲程序od第一件事,如果你是一個UNIXy系統下運行:

od -xcb .emacs 

因爲53個字符約這兩行的大小,它可能在文件末尾(或內部)有一些垃圾。

+0

每行的末尾沒有任何內容。我剛剛檢查過。還有什麼我可以做的嗎? – user1508893

+0

@ user1508893,有趣的是,第二行末尾沒有換行符。幽默我,並把其中一個英寸我會感到驚訝,如果這打破了emacs(給作者),但陌生的事情發生了。 – paxdiablo

+0

我只是把一個。也沒有工作。我有點懷疑這可能與我上次在這臺機器上安裝的一些安裝(安裝Ruby和其他東西)有關,但我真的忘了我究竟做了什麼。已經過了3天,而且我的短期記憶很差 – user1508893