2
votes

When testing cluster mnesia in one pc, I have to create many erlang nodes for one "Mac lion" user. Because they share the same ".erlang" for the same user, so I can't pass the mnesia through ".erlang" file. For the emacs erlang shell, I want to pass the mnesia directory configuration through .emacs file, so the distel's related escript codes should be modified.

(add-hook 'erlang-mode-hook
      (lambda ()
        ;; when starting an Erlang shell in Emacs, default in the node name
        ; (setq inferior-erlang-machine-options '("-name" "emacs"))
        (setq inferior-erlang-machine-options '("-name" "emacs""-mnesia dir" "/Users/yuchen/Documents/Project/mnesia_db") )
             ;;added by chenyu 2012/04/08 
             (set (make-local-variable 'compile-command) (format "make -f %s" (get-closest-pathname)))
        ;; add Erlang functions to an imenu menu
        (imenu-add-to-menubar "imenu")))

In the above code, name=emacs is ok, but mnesia dir is not effective.

(setq inferior-erlang-machine-options '("-name" "emacs""-mnesia dir" "/Users/yuchen/Documents/Project/mnesia_db") )

After the node is up, I have checked the mnesia path configuration.

([email protected])12> mnesia:system_info(directory).
"/Users/yuchen/[email protected]"

It is not same as my .emacs configuration data.

1

1 Answers

1
votes

I'd guess that you need to put -mnesia and dir in separate strings in the list of arguments, and you need to wrap the directory in double quotes as well, which of course you'd have to escape in Emacs Lisp:

(setq inferior-erlang-machine-options '("-name" "emacs" "-mnesia" "dir" "\"/Users/yuchen/Documents/Project/mnesia_db\"") )