无法在Windows上运行emacs ensime

时间:2014-10-10 10:59:54

标签: windows emacs ensime

当我点击M-x并写'ensime'时出现错误

    `flet' is an obsolete macro (as of 24.3); use either `cl-flet' or `cl-letf'.
    'let: Wrong type argument: arrayp, nil'

当我在_emacs中'需要ensime'时,它告诉我更多内容:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
file-truename(nil)
(let ((java (file-truename (executable-find "javac")))) (warn "JDK_HOME and JAVA_HOME are not       set, inferring from %s" java) (ensime--parent-dir (ensime--parent-dir java)))
 (cond ((getenv "JDK_HOME")) ((getenv "JAVA_HOME")) ((file-exists-p "/usr/libexec/java_home") (s-chomp (shell-command-to-string "/usr/libexec/java_home"))) ((quote t) (let ((java (file-truename      (executable-find "javac")))) (warn "JDK_HOME and JAVA_HOME are not set, inferring from %s" java)     (ensime--parent-dir (ensime--parent-dir java)))))
  eval((cond ((getenv "JDK_HOME")) ((getenv "JAVA_HOME")) ((file-exists-p "/usr/libexec/java_home") (s-chomp (shell-command-to-string "/usr/libexec/java_home"))) ((quote t) (let ((java (file-truename (executable-find "javac")))) (warn "JDK_HOME and JAVA_HOME are not set, inferring from %s" java) (ensime--parent-dir (ensime--parent-dir java))))))
 custom-initialize-reset(ensime-default-java-home (cond ((getenv "JDK_HOME")) ((getenv "JAVA_HOME")) ((file-exists-p "/usr/libexec/java_home") (s-chomp (shell-command-to-string "/usr/libexec/java_home"))) ((quote t) (let ((java (file-truename (executable-find "javac")))) (warn "JDK_HOME and JAVA_HOME are not set, inferring from %s" java) (ensime--parent-dir (ensime--parent-dir java))))))
  custom-declare-variable(ensime-default-java-home (cond ((getenv "JDK_HOME")) ((getenv "JAVA_HOME")) ((file-exists-p "/usr/libexec/java_home") (s-chomp (shell-command-to-string "/usr/libexec/java_home"))) ((quote t) (let ((java (file-truename (executable-find "javac")))) (warn "JDK_HOME and JAVA_HOME are not set, inferring from %s" java) (ensime--parent-dir (ensime--parent-dir java))))) "Location of the JDK's base directory" :type string :group ensime-server)
  eval-buffer(#<buffer  *load*-216581> nil "c:/Users/leokr_000/AppData/Roaming/.emacs.d/elpa/ensime-20141007.246/ensime-vars.el" nil t)  ; Reading at buffer position 2344
  load-with-code-conversion("c:/Users/leokr_000/AppData/Roaming/.emacs.d/elpa/ensime-20141007.246/ensime-vars.el" "c:/Users/leokr_000/AppData/Roaming/.emacs.d/elpa/ensime-20141007.246/ensime-vars.el" nil t)
 require(ensime-vars)
  eval-buffer(#<buffer  *load*-524611> nil "c:/Users/leokr_000/AppData/Roaming/.emacs.d/elpa/ensime-20141007.246/ensime.el" nil t)  ; Reading at buffer position 1766
  load-with-code-conversion("c:/Users/leokr_000/AppData/Roaming/.emacs.d/elpa/ensime-20141007.246/ensime.el" "c:/Users/leokr_000/AppData/Roaming/.emacs.d/elpa/ensime-20141007.246/ensime.el" nil t)
  require(ensime)
  eval-buffer(#<buffer  *load*> nil "c:/Users/leokr_000/AppData/Roaming/_emacs" nil t)  ; Reading at buffer position 220
  load-with-code-conversion("c:/Users/leokr_000/AppData/Roaming/_emacs"               "c:/Users/leokr_000/AppData/Roaming/_emacs" t t)
   load("~/_emacs" t t)
   #[0 "\205\262

这个“_emacs”文件实际上是从这里复制的https://github.com/ensime/ensime-server/wiki/Quick-Start-Guide 我正在运行Windows 8和emacs 24.3。

1 个答案:

答案 0 :(得分:0)

显然,Emas无法找到您的javac可执行文件。确保您的某个地方确实有javac(或javac.exe可能适用于您的平台),此某处列在exec-path中。详细解释:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)

这表示代码试图将nil视为数组(字符串也是数组)。

file-truename(nil)

这表示在使用参数file-truename调用nil时发生了这种情况,实际上,file-truename将文件名(字符串)作为参数,因此nil不是一个有效的论据。

(let ((java (file-truename (executable-find "javac"))))

这表示它在评估此代码时发生,我们看到file-truename的arg实际上是(executable-find "javac")返回的值,并且此表达式应返回绝对文件名{{1 (如javac中所示),如果无法找到,则为零。