(启动emacs时出现错误类型参数arrayp nil)

时间:2014-02-11 19:24:19

标签: macos emacs elisp ocaml utop

Emacs 24和Mac OSX Mavericks以及我的emacs文件如下:

(setq debug-on-error t)
;; -- common-lisp compatibility if not added earlier in your .emacs
(require 'cl)

;; -- Tuareg mode -----------------------------------------
;; Add Tuareg to your search path
(add-to-list
 'load-path
 ;; Change the path below to be wherever you've put your tuareg installation.
 (expand-file-name "~/.elisp/tuareg"))
(require 'tuareg)
(setq auto-mode-alist 
      (append '(("\\.ml[ily]?$" . tuareg-mode))
          auto-mode-alist))

;; -- Tweaks for OS X -------------------------------------
;; Tweak for problem on OS X where Emacs.app doesn't run the right
;; init scripts when invoking a sub-shell
(cond
 ((eq window-system 'ns) ; macosx
  ;; Invoke login shells, so that .profile or .bash_profile is read
  (setq shell-command-switch "-lc")))

;; -- opam and utop setup --------------------------------
;; Setup environment variables using opam
(defun opam-vars ()
  (let* ((x (shell-command-to-string "opam config env"))
     (x (split-string x "\n"))
     (x (remove-if (lambda (x) (equal x "")) x))
     (x (mapcar (lambda (x) (split-string x ";")) x))
     (x (mapcar (lambda (x) (car x)) x))
     (x (mapcar (lambda (x) (split-string x "=")) x))
     )
    x))
(dolist (var (opam-vars))
  (setenv (car var) (substring (cadr var) 1 -1)))
;; The following simpler alternative works as of opam 1.1
;; (dolist
;;    (var (car (read-from-string
;;         (shell-command-to-string "opam config env --sexp"))))
;;  (setenv (car var) (cadr var)))
;; Update the emacs path
(setq exec-path (split-string (getenv "PATH") path-separator))
;; Update the emacs load path
(push (concat (getenv "OCAML_TOPLEVEL_PATH")
          "/../../share/emacs/site-lisp") load-path)
;; Automatically load utop.el
(autoload 'utop "utop" "Toplevel for OCaml" t)
(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t)
(add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer)

修复此错误的任何帮助都会很棒。谢谢!

Nots:我确实有tuareg模式我说的是(在〜/ .elisp / tuareg中)。执行以下操作后,我开始收到此错误:

opam install \
   async yojson core_extended core_bench \
   cohttp async_graphics cryptokit menhir

不确定什么是错的,但在安装之前我基本上有相同的emacs文件并且没有问题。现在在emacs中utop在我尝试评估ocaml文件时也无法正常运行。

1 个答案:

答案 0 :(得分:0)

如上所述:

  

如果我不得不猜测,我认为opam config env现在正在输出一些能够抵抗函数操作的东西opam-vars

     

运行Emacs --debug-init,您将获得回溯。

     

以递归方式将init文件二等分,以缩小范围。