1

我的.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.

有谁知道可能是什么原因造成的?谢谢

4

2 回答 2

2

看起来 linum 模式已添加到 23.1 版(更改日志)中的 Emacs 发行版中。因为 linum 没有随 Emacs 22 一起发布,所以你调用了一个未定义的函数,因此会出现错误。

也许您曾经运行过更新版本的 emacs,但后来它已经被破坏了。您可以:

  • 下载 linum 源,将其添加到您的加载路径,require然后

  • 安装更新版本的 Emacs。


编辑:正如上面评论中提到的,您的路径上可能有多个 Emacs 二进制文件,具有不同的版本。看看/usr/bin, /opt/local/bin, et al,看看是否是这种情况。

于 2013-02-04T05:19:33.597 回答
0

首先,如果您在 UNIXy 系统下运行,我将cat使用八进制转储程序以外的其他内容检查该文件的内容:od

od -xcb .emacs

因为 53 个字符大约是这两行的大小,所以它可能在文件的末尾(或内部)有一些垃圾。

于 2013-02-04T04:05:19.453 回答