0

当我点击 Mx 并写“ensime”时出现错误

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

当我在 _emacs 中有 'require 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。

4

1 回答 1

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"))))

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

于 2014-10-10T12:44:47.003 回答