使用emacs-live加载emacs时出错

时间:2015-04-06 18:18:09

标签: emacs tramp

当我启动emacs时,我收到错误

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("cmd\\.exe" nil)
  (if (string-match "cmd\\.exe" tramp-encoding-shell) "/c" "-c")
  eval((if (string-match "cmd\\.exe" tramp-encoding-shell) "/c" "-c"))

加载magit包时似乎会发生这种情况

  eval-buffer(#<buffer  *load*-330059> nil "c:/cygwin64/home/johnstonk/.emacs.d/emacs-live/packs/stable/git-pack/lib/magit/magit.el" nil t)  ; Reading at buffer position 3100

我确认这发生在emacs-live的新git克隆中。 我尝试在live init文件中删除magit包,但是在加载clojure包时我再次遇到了同样的错误。看起来像tramp中的nil字符串错误。

有谁知道为什么?

1 个答案:

答案 0 :(得分:1)

继续并加载tramp-sh.el的源代码我在第一行(wrong-type-argument stringp nil)

获得了相同的(require 'tramp)

所以我加载了tramp.el(版本22.1)并进入了

部分
(defcustom tramp-encoding-shell
  (if (memq system-type '(windows-nt))
      (getenv "COMSPEC")...

我注意到这个系统类型设置为windows-nt(因为它应该,我在windows7上),但(getenv "COMSPEC")返回nil。从我在其他地方搜索到的,这个COMSPEC环境变量预计存在于Windows机器上并指向shell。 Tramp使用tramp-encoding-shell var在本地机器上编码和解码命令,例如“〜” - 至少根据tramps注释。

COMSPEC不存在作为系统环境变量对我来说所以我创建它并指向cmd.exe C:\Windows\System32\cmd.exe这为我修复了它。

注意不要将COMSPEC设置为powershell,我尝试使用lein时遇到了一个令人讨厌的内存泄漏(继续尝试创建服务器,失败,再次尝试但是没有不要清理以前的帖子。