0

我已经浏览了其他主题,但我仍然找不到解决方案。我正在尝试在 Windows 7 中为 Emacs 安装“nxhtml”插件。我已经将“HOME”环境变量设置为“C:\”。所以,我的 .emacs.d 文件夹就在那里,我把 nxhtml 放在那里,并将下面的行添加到我的“_emacs.d”文件中,正如自述文件所说:

(加载“C:\.emacs.d\nxhtml\autostart.el”)

但它不加载。

我也试过把:(add-to-list 'load-path "C:\.emacs.d\nxhtml")

(加载“autostart.el”)

但无济于事......有人可以在这里阐明一下吗?tnx。

4

2 回答 2

1

A number of points here:

Firstly, _emacs.d is not a default file name for your init file, ie emacs will not load it automatically. Try ~/.emacs.d/init.el, or ~/.emacs instead.

Secondly, Windows 7 has a feature where it prevents programs from writing to certain system directories, but for backwards compatibility for the many old programs that do this, rather than causing them to fail, it silently redirects the write elsewhere, in an application specific directory. C:\ is one of those directories, so setting your HOME to point there is asking for trouble.

Thirdly, see the other response about backslash being an escape character in Lisp strings.

于 2013-06-04T13:22:59.880 回答
1

\在字符串的(双引号)读取语法中是特殊的,因为某些字符在以反斜杠为前缀时具有新的含义(例如\n,换行符、\t制表符和\"双引号字符)。当后面的字符与反斜杠没有任何特殊含义时,将逐字使用该字符,而忽略反斜杠。

"C:\.emacs.d\nxhtml\autostart.el"实际上是字符串:

C:.emacs.d
xhtml^Gutostart.el

\在字符串中包含 a ,您需要编写\\

然而,尽管它会理解反斜杠,但 Emacs 现在在所有平台上都是一致的,允许/作为目录分隔符1 ; 所以就这样做吧。

1directory-sep-char并且已完全删除过时的变量。

于 2013-06-04T02:57:22.317 回答