<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Ngoc Dao wrote:
<blockquote
 cite="mid:5c493e530909130705t6f7afd4dubf5fe95a30485129@mail.gmail.com"
 type="cite">
  <pre wrap="">After many try-and-errors I suspect that Distel currently can only
interpret a module if its .beam file is in the same directory with its
.erl file, or in ../ebin. Is this true? How to overcome this problem?

  </pre>
</blockquote>
Maybe add_path will help you. <br>
<blockquote>@spec code:add_patha(Dir) => true | {error,
bad_directory}<br>
</blockquote>
And you can check this by code:get_path().<br>
<br>
<blockquote
 cite="mid:5c493e530909130705t6f7afd4dubf5fe95a30485129@mail.gmail.com"
 type="cite">
  <pre wrap="">
On Sat, Sep 12, 2009 at 1:09 AM, Eric Liang <a class="moz-txt-link-rfc2396E" href="mailto:eric.l.2046@gmail.com"><eric.l.2046@gmail.com></a> wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Eric Liang wrote:

Ngoc Dao wrote:

I tried Distel from trunk yesterday and it did not work. The version
from download did work:
<a class="moz-txt-link-freetext" href="http://code.google.com/p/distel/downloads/list">http://code.google.com/p/distel/downloads/list</a>.



Thanks Ngoc, it works. But, still can't debug and profile, like Bill
Clementson's introduction.

When I type C-c C-d i, it looks like is interpreting forever, and can't set
breakpoints to debug. I've checked the archive of this mailling list, there
is only one unresolved thread here:

<a class="moz-txt-link-freetext" href="http://groups.google.com/group/erlang-programming/browse_thread/thread/c34d5245998948c6">http://groups.google.com/group/erlang-programming/browse_thread/thread/c34d5245998948c6</a>

Do you have more suggestions? TIA.

I think I've resolved this. Just load module (C-c C-d L) before being
interpreted. So simple. :-[

In Distel, load module will tell you nothing more than "load: [module
test_ring]", except the first time is successful, in which scenario, it will
tell you "Successfully uploaded backend modules into node". So, It's
difficulty to  know  whether or not the module was loaded  successfully.

And, one module can be loaded only if it's beam has been compiled by the
flag: debug_info.


On Thu, Sep 10, 2009 at 6:46 PM, Eric Liang <a class="moz-txt-link-rfc2396E" href="mailto:eric.l.2046@gmail.com"><eric.l.2046@gmail.com></a> wrote:


Hi all,
To build a erlang IDE, I've tried Distel in emacs22. but unfortunately it
does not work well. What I've done is exactly in accordance with Bill
Clementson's blog post:

<a class="moz-txt-link-freetext" href="http://bc.tech.coop/blog/070528.html">http://bc.tech.coop/blog/070528.html</a>

They are:

Download the latest code from :  <a class="moz-txt-link-freetext" href="http://distel.googlecode.com/svn/trunk/">http://distel.googlecode.com/svn/trunk/</a>
Modify the .emacs. I did confirm the load-path and distel-dir settings are
correct. Here is it:

;; This is needed for Erlang mode setup
(setq erlang-root-dir "/usr/local/lib/erlang")
(setq load-path (cons "/usr/local/lib/erlang/lib/tools-2.5.1/emacs"
load-path))
(setq exec-path (cons "/usr/local/lib/erlang/bin" exec-path))
(require 'erlang-start)

;; This is needed for Distel setup
(let ((distel-dir "/Users/bc/Projects/distel/elisp"))
  (unless (member distel-dir load-path)
    ;; Add distel-dir to the end of load-path
    (setq load-path (append load-path (list distel-dir)))))

(require 'distel)
(distel-setup)

;; Some Erlang customizations
(add-hook 'erlang-mode-hook
          (lambda ()
            ;; when starting an Erlang shell in Emacs, default in the node name
            (setq inferior-erlang-machine-options '("-sname" "emacs"))
            ;; add Erlang functions to an imenu menu
            (imenu-add-to-menubar "imenu")))

;; A number of the erlang-extended-mode key bindings are useful in the shell
too
(defconst distel-shell-keys
  '(("\C-\M-i"   erl-complete)
    ("\M-?"      erl-complete)        
    ("\M-."      erl-find-source-under-point)
    ("\M-,"      erl-find-source-unwind)
    ("\M-*"      erl-find-source-unwind)
    )
  "Additional keys to bind when in Erlang shell.")

(add-hook 'erlang-shell-mode-hook
          (lambda ()
            ;; add some Distel bindings to the Erlang shell
            (dolist (spec distel-shell-keys)
              (define-key erlang-shell-mode-map (car spec) (cadr spec)))))

When I open a .erl file, it works well and Distel dose exist in the Erlang
tag of the emacs' menubar. But when I type C-M-i behind the word "cr" to
complete the function name,the emacs received this message:

Unexpected reply: [rex [badrpc [EXIT [undef ([distel rpc_entry (distel
modules ("cr"))] [rpc -handle_call/3-fun-0- 5])]]]]

I checked the code in Distel, it looks like that it will call completions()
which will call the get() by the argument:A  an empty string("")  in
otp_doc.erl.  The function get() will call to_list() on the argument:A,which
will get the error:

*** ERROR: Shell process terminated! ***

=ERROR REPORT==== 8-Sep-2009::15:02:42 ===
Error in process <0.66.0> on node 'emacs@doubleclick' with exit value:
{undef,[{lib,format_exception,[4,error,undef,[{erl_internal,bif,[to_list,1]},{erl_lint,expr,3},{erl_lint,exprs,3},{erl_lint,exprs_opt,3},{erl_eval,check_command,2},{shell,exprs,6},{shell,eval_exprs,6},{shell,eval_loop..

I guess this is the reason for the completion failure, but have no idea how
to fix it. Can anyone here give me some advice?

As a newbie in Erlang, it's very possible I've stepped in the wrong
way.However, any suggestions will be appreciated.

Thanks in advance.

Eric



    </pre>
  </blockquote>
</blockquote>
<br>
</body>
</html>