无法在 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 "205262

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

显然,Emas找不到您的javac可执行文件。确保您确实在某个地方有javac(或javac.exe,可能用于您的平台),并且exec-path中列出了这个的某个。详细说明:

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

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

file-truename(nil)

这说明它是在使用参数nil调用file-truename时发生的,事实上,file-truename将文件名(字符串)作为参数,因此nil不是它的有效参数。

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

这说明它是在评估此代码时发生的,我们看到file-truename的arg实际上是(executable-find "javac")返回的值,此表达式应该返回javac的绝对文件名(如exec-path中所示),或者如果找不到,则返回nil

相关内容

  • 没有找到相关文章

最新更新